module Benchmark::Perf::Clock
Clock
that represents monotonic time
Constants
- MICROSECONDS_PER_100MS
Microseconds per 100ms
- MICROSECONDS_PER_SECOND
Microseconds per second
- MONOTONIC_CLOCK
Public Class Methods
measure() { || ... }
click to toggle source
Measure time elapsed with a monotonic clock
@return [Float]
@public
# File lib/benchmark/perf/clock.rb, line 58 def measure before = now yield after = now after - before end
new()
click to toggle source
Calls superclass method
# File lib/benchmark/perf/clock.rb, line 14 def initialize super() @last_time = Time.now.to_f @lock = Mutex.new end
now()
click to toggle source
@api private
# File lib/benchmark/perf/clock.rb, line 22 def now Process.clock_gettime(Process::CLOCK_MONOTONIC) end
Private Instance Methods
measure() { || ... }
click to toggle source
Measure time elapsed with a monotonic clock
@return [Float]
@public
# File lib/benchmark/perf/clock.rb, line 58 def measure before = now yield after = now after - before end
now()
click to toggle source
@api private
# File lib/benchmark/perf/clock.rb, line 22 def now Process.clock_gettime(Process::CLOCK_MONOTONIC) end