Class: Puppet::Util::Profiler::WallClock::Timer Private
- 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
-
#initialize ⇒ Timer
constructor
private
A new instance of Timer.
- #stop ⇒ Object private
- #to_s ⇒ Object private
Constructor Details
#initialize ⇒ Timer
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.
23 24 25 |
# File 'lib/puppet/util/profiler/wall_clock.rb', line 23 def initialize @start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) end |
Instance Method Details
#stop ⇒ 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.
27 28 29 30 |
# File 'lib/puppet/util/profiler/wall_clock.rb', line 27 def stop @time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_second) - @start @time end |
#to_s ⇒ 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.
32 33 34 |
# File 'lib/puppet/util/profiler/wall_clock.rb', line 32 def to_s format(FOUR_DECIMAL_DIGITS, @time) end |