Class: Puppet::Util::Profiler::Aggregate::Metric

Inherits:
Hash
  • Object
show all
Defined in:
lib/puppet/util/profiler/aggregate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMetric

Returns a new instance of Metric.



50
51
52
53
54
# File 'lib/puppet/util/profiler/aggregate.rb', line 50

def initialize
  super
  @count = 0
  @time = 0
end

Instance Attribute Details

#countObject (readonly)



55
56
57
# File 'lib/puppet/util/profiler/aggregate.rb', line 55

def count
  @count
end

#timeObject (readonly)



55
56
57
# File 'lib/puppet/util/profiler/aggregate.rb', line 55

def time
  @time
end

Instance Method Details

#[](key) ⇒ Object



57
58
59
60
61
62
# File 'lib/puppet/util/profiler/aggregate.rb', line 57

def [](key)
  unless has_key?(key)
    self[key] = Metric.new
  end
  super(key)
end

#add_time(time) ⇒ Object



68
69
70
# File 'lib/puppet/util/profiler/aggregate.rb', line 68

def add_time(time)
  @time += time
end

#incrementObject



64
65
66
# File 'lib/puppet/util/profiler/aggregate.rb', line 64

def increment
  @count += 1
end