module Quandl::Client::Base::Benchmark

Public Instance Methods

benchmarks() click to toggle source
# File lib/quandl/client/base/benchmark.rb, line 32
def benchmarks
  @benchmarks ||= {}
end
human_benchmarks() click to toggle source
# File lib/quandl/client/base/benchmark.rb, line 28
def human_benchmarks
  benchmarks.sort_by{|k,v| v }.reverse.collect{|k,v| "#{k}: #{v.microseconds}ms" }.join(' | ')
end

Private Instance Methods

benchmark(name, &block) click to toggle source
# File lib/quandl/client/base/benchmark.rb, line 38
def benchmark(name, &block)
  timer = Time.now
  result = block.call
  self.benchmarks[name.to_sym] ||= timer.elapsed
  result
end