Module: SSO::Benchmarking

Overview

Helper to log results of benchmarks.

Instance Method Summary collapse

Methods included from Logging

#debug, #error, #fatal, #info, #logger, #progname, #warn

Instance Method Details

#benchmark(name, &block) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/sso/benchmarking.rb', line 6

def benchmark(name, &block)
  result = nil
  seconds = Benchmark.realtime do
    result = block.call
  end
  info { "#{name} took #{(seconds * 1000).round}ms" }
  result
end