module Variable::Timer

Public Class Methods

elapsed() { || ... } click to toggle source

Monotonic elapsed time of block execution

@return [Float]

# File lib/variable.rb, line 62
def self.elapsed
  start = now
  yield
  now - start
end

Private Class Methods

now() click to toggle source

The now monotonic time

@return [Float]

# File lib/variable.rb, line 71
def self.now
  Process.clock_gettime(Process::CLOCK_MONOTONIC)
end