Class: Hoss::ChildDurations::Durations Private
- Inherits:
-
Object
- Object
- Hoss::ChildDurations::Durations
- Defined in:
- lib/hoss/child_durations.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.
Instance Attribute Summary collapse
- #duration ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize ⇒ Durations
constructor
private
A new instance of Durations.
- #start ⇒ Object private
- #stop ⇒ Object private
Constructor Details
#initialize ⇒ Durations
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 Durations.
40 41 42 43 44 45 |
# File 'lib/hoss/child_durations.rb', line 40 def initialize @nesting_level = 0 @start = nil @duration = 0 @mutex = Mutex.new end |
Instance Attribute Details
#duration ⇒ Object (readonly)
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.
47 48 49 |
# File 'lib/hoss/child_durations.rb', line 47 def duration @duration end |
Instance Method Details
#start ⇒ 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.
49 50 51 52 53 54 |
# File 'lib/hoss/child_durations.rb', line 49 def start @mutex.synchronize do @nesting_level += 1 @start = Util.micros if @nesting_level == 1 end end |
#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.
56 57 58 59 60 61 |
# File 'lib/hoss/child_durations.rb', line 56 def stop @mutex.synchronize do @nesting_level -= 1 @duration = (Util.micros - @start) if @nesting_level == 0 end end |