Class: Puppet::Util::Profiler::Aggregate::Metric
- Defined in:
- lib/puppet/util/profiler/aggregate.rb
Instance Attribute Summary collapse
- #count ⇒ Object readonly
- #time ⇒ Object readonly
Instance Method Summary collapse
- #[](key) ⇒ Object
- #add_time(time) ⇒ Object
- #increment ⇒ Object
-
#initialize ⇒ Metric
constructor
A new instance of Metric.
Constructor Details
#initialize ⇒ Metric
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
#count ⇒ Object (readonly)
55 56 57 |
# File 'lib/puppet/util/profiler/aggregate.rb', line 55 def count @count end |
#time ⇒ Object (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 |
#increment ⇒ Object
64 65 66 |
# File 'lib/puppet/util/profiler/aggregate.rb', line 64 def increment @count += 1 end |