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

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(message = "Benchmarking")
  real = Benchmark.realtime { yield }
  info "#{message}: time = #{'%.5f' % real} ms."
end