Sha256: ab34954efb9946b6b6b79ecb6d16c6c09e18cc60f4450906b20c5318e1b9d7de

Contents?: true

Size: 447 Bytes

Versions: 2

Compression:

Stored size: 447 Bytes

Contents

require 'benchmark'

module Nitro
  
# This helper adds benchmarking support in your Controllers.
# Useful for fine tuning and optimizing your actions.

module BenchmarkHelper

  # Log real time spent on a task. 
  # 
  # === Example
  # 
  # benchmark "Doing an operation" { operation }
  
  def benchmark(message = 'Benchmarking')
    real = Benchmark.realtime { yield }
    Logger.info "#{message}: time = #{'%.5f' % real} ms."
  end

end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro/helper/benchmark.rb
nitro-0.40.0 lib/nitro/helper/benchmark.rb