class Puppet::Util::Profiler::Aggregate

Public Instance Methods

do_finish(context, description, metric_id) click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 22
def do_finish(context, description, metric_id)
  result = super(context, description, metric_id)
  update_metric(@metrics_hash, metric_id, result[:time])
  result
end
do_start(description, metric_id) click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 18
def do_start(description, metric_id)
  super(description, metric_id)
end
print_metrics(metrics_hash, prefix) click to toggle source
shutdown() click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 10
def shutdown()
  super
  @logger.call("AGGREGATE PROFILING RESULTS:")
  @logger.call("----------------------------")
  print_metrics(@metrics_hash, "")
  @logger.call("----------------------------")
end
update_metric(metrics_hash, metric_id, time) click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 28
def update_metric(metrics_hash, metric_id, time)
  first, *rest = *metric_id
  if first
    m = metrics_hash[first]
    m.increment
    m.add_time(time)
    if rest.count > 0
      update_metric(m, rest, time)
    end
  end
end
values() click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 40
def values
  @metrics_hash
end

Public Class Methods

new(logger, identifier) click to toggle source
# File lib/puppet/util/profiler/aggregate.rb, line 5
def initialize(logger, identifier)
  super(logger, identifier)
  @metrics_hash = Metric.new
end