Module: Puppet::Util::Profiler
- Defined in:
- lib/puppet/util/profiler.rb
Overview
A simple profiling callback system.
Defined Under Namespace
Classes: Aggregate, AroundProfiler, Logging, ObjectCounts, WallClock
Class Method Summary collapse
- .add_profiler(profiler) ⇒ Object private
-
.clear ⇒ Object
private
Reset the profiling system to the original state.
-
.current ⇒ Object
private
Retrieve the current list of profilers.
-
.profile(message, metric_id, &block) ⇒ Object
Profile a block of code and log the time it took to execute.
- .remove_profiler(profiler) ⇒ Object private
Class Method Details
.add_profiler(profiler) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 |
# File 'lib/puppet/util/profiler.rb', line 31 def self.add_profiler(profiler) @profiler.add_profiler(profiler) end |
.clear ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Reset the profiling system to the original state
18 19 20 |
# File 'lib/puppet/util/profiler.rb', line 18 def self.clear @profiler.clear end |
.current ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Retrieve the current list of profilers
25 26 27 |
# File 'lib/puppet/util/profiler.rb', line 25 def self.current @profiler.current end |
.profile(message, metric_id, &block) ⇒ Object
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.
52 53 54 |
# File 'lib/puppet/util/profiler.rb', line 52 def self.profile(, metric_id, &block) @profiler.profile(, metric_id, &block) end |
.remove_profiler(profiler) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/puppet/util/profiler.rb', line 37 def self.remove_profiler(profiler) @profiler.remove_profiler(profiler) end |