class Minitest::GCStatsReporter
Attributes
Public Class Methods
Source
# File lib/minitest/gcstats.rb, line 80 def initialize max super() self.max = max self.stats = {} end
Calls superclass method
Public Instance Methods
Source
# File lib/minitest/gcstats.rb, line 87 def record result self.stats[result] = result.gc_stats end
Source
# File lib/minitest/gcstats.rb, line 91 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