Module: Puppet::Util::Profiler
- Defined in:
- lib/puppet/util/profiler.rb
Overview
A simple profiling callback system.
Defined Under Namespace
Classes: Logging, None, ObjectCounts, WallClock
Constant Summary collapse
Class Method Summary collapse
-
.clear ⇒ Object
private
Reset the profiling system to the original state.
-
.current ⇒ Object
private
This thread’s configured profiler.
- .current=(profiler) ⇒ Object private
-
.profile(message, &block) ⇒ Object
Profile a block of code and log the time it took to execute.
Class Method Details
.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
16 17 18 |
# File 'lib/puppet/util/profiler.rb', line 16 def self.clear @profiler = nil 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.
Returns This thread’s configured profiler.
22 23 24 |
# File 'lib/puppet/util/profiler.rb', line 22 def self.current @profiler || NONE end |
.current=(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.
28 29 30 |
# File 'lib/puppet/util/profiler.rb', line 28 def self.current=(profiler) @profiler = profiler end |
.profile(message, &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 hierachy.
42 43 44 |
# File 'lib/puppet/util/profiler.rb', line 42 def self.profile(, &block) current.profile(, &block) end |