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

Methods included from DeepMerge::DeepMergeHash

#deep_merge, #deep_merge!, #ko_deep_merge!

Methods included from DeepMerge::RailsCompat

#deeper_merge, #deeper_merge!, #ko_deeper_merge!

Constructor Details

#initializeMetric

Returns a new instance of Metric.



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

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

Instance Attribute Details

#countObject (readonly)



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

def count
  @count
end

#timeObject (readonly)



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

def time
  @time
end

Instance Method Details

#[](key) ⇒ Object



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

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

#add_time(time) ⇒ Object



70
71
72
# File 'lib/puppet/util/profiler/aggregate.rb', line 70

def add_time(time)
  @time += time
end

#incrementObject



66
67
68
# File 'lib/puppet/util/profiler/aggregate.rb', line 66

def increment
  @count += 1
end