class Memory::Report
Attributes
total_allocated[R]
Public Class Methods
general()
click to toggle source
# File lib/memory/report.rb, line 27 def self.general Report.new([ Aggregate.new("By Gem", &:gem), Aggregate.new("By File", &:file), Aggregate.new("By Location", &:location), Aggregate.new("By Class", &:class_name), ValueAggregate.new("Strings By Gem", &:gem), ValueAggregate.new("Strings By Location", &:location), ]) end
new(aggregates)
click to toggle source
# File lib/memory/report.rb, line 38 def initialize(aggregates) @total_allocated = Aggregate::Total.new @total_retained = Aggregate::Total.new @aggregates = aggregates end
Public Instance Methods
concat(allocations)
click to toggle source
# File lib/memory/report.rb, line 47 def concat(allocations) allocations.each do |allocation| @total_allocated << allocation @total_retained << allocation if allocation.retained @aggregates.each do |aggregate| aggregate << allocation end end end
print(io = $stderr)
click to toggle source
# File lib/memory/report.rb, line 58 def print(io = $stderr) io.puts "\# Memory Profile", nil io.puts "- Total Allocated: #{@total_allocated}" io.puts "- Total Retained: #{@total_retained}" io.puts @aggregates.each do |aggregate| aggregate.print(io) end end