Module: Flue::Benchmark

Included in:
ERBFilter, Runner
Defined in:
lib/flue/benchmark.rb

Instance Method Summary collapse

Instance Method Details

#benchmark(label) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/flue/benchmark.rb', line 5

def benchmark(label)
  result = nil
  ms = ::Benchmark.realtime do
    result = yield
  end
  if logger
    logger.info "#{label} (#{ms})"
  end
  result
end