class SpeedGun::App

Public Instance Methods

source_line_id(filename, line) click to toggle source
# File lib/speed_gun/app.rb, line 18
def source_line_id(filename, line)
  (@source_line_ids ||= {}).fetch("#{filename}:#{line}") do |key|
    Digest::MD5.hexdigest(key)
  end
end

Private Instance Methods

treeish_events(events) click to toggle source
# File lib/speed_gun/app.rb, line 42
def treeish_events(events)
  root = []
  prev_events = []
  events.sort_by(&:started_at).each do |event|
    prev_events.reject! { |pv| pv.roughly_finished_at < event.started_at }
    if prev_events.empty?
      root.push(event)
    else
      prev_events.last.children.push(event)
    end
    prev_events.push(event)
  end
  root
end