lib/stackprof/report.rb in stackprof-0.2.8 vs lib/stackprof/report.rb in stackprof-0.2.9
- old
+ new
@@ -7,11 +7,11 @@
@data = data
end
attr_reader :data
def frames(sort_by_total=false)
- Hash[ *@data[:frames].sort_by{ |iseq, stats| -stats[sort_by_total ? :total_samples : :samples] }.flatten(1) ]
+ @data[:frames].sort_by{ |iseq, stats| -stats[sort_by_total ? :total_samples : :samples] }.inject({}){|h, (k, v)| h[k] = v; h}
end
def normalized_frames
id2hash = {}
@data[:frames].each do |frame, info|
@@ -254,10 +254,10 @@
f.puts "totals: #{@data[:samples]}"
end
def print_method(name, f = STDOUT)
- name = /#{Regexp.escape name}/ unless Regexp === name
+ name = /#{name}/ unless Regexp === name
frames.each do |frame, info|
next unless info[:name] =~ name
file, line = info.values_at(:file, :line)
line ||= 1