class Minitest::GCStatsReporter
Attributes
max[RW]
stats[RW]
Public Class Methods
new(max)
click to toggle source
Calls superclass method
# File lib/minitest/gcstats.rb, line 78 def initialize max super() self.max = max self.stats = {} end
Public Instance Methods
record(result)
click to toggle source
# File lib/minitest/gcstats.rb, line 85 def record result self.stats[result] = result.gc_stats end
report()
click to toggle source
# File lib/minitest/gcstats.rb, line 89 def report total = stats.values.sum pct = total / 100.0 puts puts "Top #{max} tests by objects allocated" puts stats.sort_by { |k,v| [-v, k.class.name, k.name] }.first(max).each do |k,v| puts "%6d (%5.2f%%): %s" % [v, v / pct, k] end puts puts "%6d: %s" % [total, "Total"] end