Module: Async::Clock
- Defined in:
- lib/async/clock.rb
Class Method Summary collapse
-
.measure ⇒ Object
Measure the execution of a block of code.
-
.now ⇒ Object
Get the current elapsed monotonic time.
Class Method Details
.measure ⇒ Object
Measure the execution of a block of code.
29 30 31 32 33 34 35 |
# File 'lib/async/clock.rb', line 29 def self.measure start_time = self.now yield return self.now - start_time end |
.now ⇒ Object
Get the current elapsed monotonic time.
24 25 26 |
# File 'lib/async/clock.rb', line 24 def self.now ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) end |