class Funk::Instruments::Timings

Public Class Methods

new() click to toggle source
# File lib/funk/instruments/timings.rb, line 4
def initialize()
  @timings = {}
end

Public Instance Methods

after_call(fn, input, value) click to toggle source
# File lib/funk/instruments/timings.rb, line 12
def after_call(fn, input, value)
  @timings[fn.name][:end] = Time.now
end
before_call(fn, input) click to toggle source
# File lib/funk/instruments/timings.rb, line 8
def before_call(fn, input)
  @timings[fn.name] = {:start => Time.now}
end
each() { |t, t| ... } click to toggle source
# File lib/funk/instruments/timings.rb, line 16
def each
  @timings.sort {|a,b|
    a[1][:start] <=> b[1][:start]
  }.each do |t|
    yield t[0], t[1]
  end
end