Methods
Public Instance methods
Measures the execution time of a block in a template and reports the result to the log. Example:
<% benchmark "Notes section" do %> <%= expensive_notes_operation %> <% end %>
Will add something like "Notes section (0.34523)" to the log.
You may give an optional logger level as the second argument (:debug, :info, :warn, :error). The default is :info.
[ show source ]
# File vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb, line 16 16: def benchmark(message = "Benchmarking", level = :info) 17: if @logger 18: real = Benchmark.realtime { yield } 19: @logger.send level, "#{message} (#{'%.5f' % real})" 20: end 21: end