class Memory::ValueAggregate

Public Class Methods

new(title, &block) click to toggle source
# File lib/memory/aggregate.rb, line 101
def initialize(title, &block)
        @title = title
        @metric = block
        
        @aggregates = Hash.new{|h,k| h[k] = Aggregate.new(k.inspect, &@metric)}
end

Public Instance Methods

<<(allocation) click to toggle source
# File lib/memory/aggregate.rb, line 108
def << allocation
        if value = allocation.value
                aggregate = @aggregates[value]
                
                aggregate << allocation
        end
end
aggregates_by(key) click to toggle source
# File lib/memory/aggregate.rb, line 116
def aggregates_by(key)
        @aggregates.sort_by{|value, aggregate| [aggregate.total[key], value]}
end
print(io = $stderr, limit: 10, level: 2) click to toggle source