Class: Puppet::Util::Profiler::WallClock::Timer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/util/profiler/wall_clock.rb

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

Constant Summary collapse

FOUR_DECIMAL_DIGITS =

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.

'%0.4f'

Instance Method Summary collapse

Constructor Details

#initializeTimer

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 a new instance of Timer.



21
22
23
# File 'lib/puppet/util/profiler/wall_clock.rb', line 21

def initialize
  @start = Time.now
end

Instance Method Details

#stopObject

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.



25
26
27
28
# File 'lib/puppet/util/profiler/wall_clock.rb', line 25

def stop
  @time = Time.now - @start
  @time
end

#to_sObject

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.



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

def to_s
  format(FOUR_DECIMAL_DIGITS, @time)
end