Class: Memory::Report
- Inherits:
-
Object
- Object
- Memory::Report
- Defined in:
- lib/memory/report.rb
Instance Attribute Summary collapse
-
#total_allocated ⇒ Object
readonly
Returns the value of attribute total_allocated.
Class Method Summary collapse
Instance Method Summary collapse
- #concat(allocations) ⇒ Object
-
#initialize(aggregates) ⇒ Report
constructor
A new instance of Report.
- #print(io = $stderr) ⇒ Object
Constructor Details
Instance Attribute Details
#total_allocated ⇒ Object (readonly)
Returns the value of attribute total_allocated.
45 46 47 |
# File 'lib/memory/report.rb', line 45 def total_allocated @total_allocated end |
Class Method Details
.general ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# 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 |
Instance Method Details
#concat(allocations) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# 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) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 |
# 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 |