Module: Async::Clock

Defined in:
lib/async/clock.rb

Class Method Summary collapse

Class Method Details

.measureObject

Measure the execution of a block of code.



31
32
33
34
35
36
37
# File 'lib/async/clock.rb', line 31

def self.measure
	start_time = self.now
	
	yield
	
	return self.now - start_time
end

.nowObject

Get the current elapsed monotonic time.



26
27
28
# File 'lib/async/clock.rb', line 26

def self.now
	::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
end