Module: Raw::BenchmarkHelper
- Defined in:
- lib/raw/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/raw/helper/benchmark.rb', line 16 def benchmark( = "Benchmarking") real = Benchmark.realtime { yield } info "#{}: time = #{'%.5f' % real} ms." end |