Module: Puppet::Util::Profiler Private

Defined in:
lib/puppet/util/profiler.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

A simple profiling callback system.

Defined Under Namespace

Classes: Logging, None, ObjectCounts, WallClock

Constant Summary collapse

NONE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Puppet::Util::Profiler::None.new

Class Method Summary collapse

Class Method Details

.clearObject

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



14
15
16
# File 'lib/puppet/util/profiler.rb', line 14

def self.clear
  @profiler = nil
end

.currentObject

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.

Returns:

  • This thread’s configured profiler



19
20
21
# File 'lib/puppet/util/profiler.rb', line 19

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.

Parameters:

  • profiler (#profile)

    A profiler for the current thread



24
25
26
# File 'lib/puppet/util/profiler.rb', line 24

def self.current=(profiler)
  @profiler = profiler
end

.profile(message, &block) ⇒ 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.

Parameters:

  • message (String)

    A description of the profiled event

  • block (Block)

    The segment of code to profile



30
31
32
# File 'lib/puppet/util/profiler.rb', line 30

def self.profile(message, &block)
  current.profile(message, &block)
end