module Puppet::Util::Profiler

A simple profiling callback system.

@api public

Public Class Methods

add_profiler(profiler) click to toggle source

@param profiler [#profile] A profiler for the current thread @api private

   # File lib/puppet/util/profiler.rb
29 def self.add_profiler(profiler)
30   @profiler.add_profiler(profiler)
31 end
clear() click to toggle source

Reset the profiling system to the original state

@api private

   # File lib/puppet/util/profiler.rb
16 def self.clear
17   @profiler.clear
18 end
current() click to toggle source

Retrieve the current list of profilers

@api private

   # File lib/puppet/util/profiler.rb
23 def self.current
24   @profiler.current
25 end
profile(message, metric_id, &block) click to toggle source

Profile a block of code and log the time it took to execute.

This outputs logs entries to the Puppet masters logging destination providing the time it took, a message describing the profiled code and a leaf location marking where the profile method was called in the profiled hierarchy.

@param message [String] A description of the profiled event @param metric_id [Array] A list of strings making up the ID of a metric to profile @param block [Block] The segment of code to profile @api public

   # File lib/puppet/util/profiler.rb
50 def self.profile(message, metric_id, &block)
51   @profiler.profile(message, metric_id, &block)
52 end
remove_profiler(profiler) click to toggle source

@param profiler [#profile] A profiler to remove from the current thread @api private

   # File lib/puppet/util/profiler.rb
35 def self.remove_profiler(profiler)
36   @profiler.remove_profiler(profiler)
37 end