aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/benchmark_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/benchmark_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/benchmark_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/benchmark_helper.rb b/actionpack/lib/action_view/helpers/benchmark_helper.rb
index 743d1d40ec..2401338896 100644
--- a/actionpack/lib/action_view/helpers/benchmark_helper.rb
+++ b/actionpack/lib/action_view/helpers/benchmark_helper.rb
@@ -15,15 +15,15 @@ module ActionView
# <%= expensive_files_operation %>
# <% end %>
#
- # That would add something like "Process data files (0.34523)" to the log,
+ # That would add something like "Process data files (345.23ms)" to the log,
# which you can then use to compare timings when optimizing your code.
#
# You may give an optional logger level as the second argument
# (:debug, :info, :warn, :error); the default value is :info.
def benchmark(message = "Benchmarking", level = :info)
if controller.logger
- real = Benchmark.realtime { yield }
- controller.logger.send(level, "#{message} (#{'%.5f' % real})")
+ seconds = Benchmark.realtime { yield }
+ controller.logger.send(level, "#{message} (#{'%.2f' % (seconds * 1000)}ms)")
else
yield
end