Module: Nitro::BenchmarkHelper
- Defined in:
- lib/nitro/helper/benchmark.rb
Overview
This helper adds benchmarking support in your Controllers. Useful for fine tuning and optimizing your actions.
Instance Method Summary collapse
-
#benchmark(message = 'Benchmarking') ⇒ Object
Log real time spent on a task.
Instance Method Details
#benchmark(message = 'Benchmarking') ⇒ Object
Log real time spent on a task.
Example
benchmark “Doing an operation” { operation }
16 17 18 19 |
# File 'lib/nitro/helper/benchmark.rb', line 16 def benchmark( = 'Benchmarking') real = Benchmark.realtime { yield } Logger.info "#{}: time = #{'%.5f' % real} ms." end |