Sha256: 55693c9c5b37ab5d3cb217a86660b13dbf3ec532098d60dcb400ee80640281bf
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
module Pilfer class Profile include Enumerable attr_accessor :data, :start def initialize(data, start) @data = data @start = start end def each(&block) files.to_a.sort_by(&:first).each(&block) end def files data.inject({}) do |files, (file, lines)| profile_lines = {} lines[1..-1].each_with_index do |data, number| next unless data.any? {|datum| datum > 0 } wall_time, cpu_time, calls = data profile_lines[number] = { 'wall_time' => wall_time, 'cpu_time' => cpu_time, 'calls' => calls } end total_wall, child_wall, exclusive_wall, total_cpu, child_cpu, exclusive_cpu = lines[0] wall = total_wall cpu = total_cpu files[file] = { 'wall_time' => wall, 'cpu_time' => cpu, 'lines' => profile_lines } files end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pilfer-1.0.2 | lib/pilfer/profile.rb |
pilfer-1.0.1 | lib/pilfer/profile.rb |
pilfer-1.0.0 | lib/pilfer/profile.rb |
pilfer-0.0.1.pre4 | lib/pilfer/profile.rb |