Module: Benchmark::Perf::Clock
- Defined in:
- lib/benchmark/perf/clock.rb
Overview
Clock that represents monotonic time
Constant Summary collapse
- MICROSECONDS_PER_SECOND =
Microseconds per second
1_000_000
- MICROSECONDS_PER_100MS =
Microseconds per 100ms
100_000
Class Method Summary collapse
-
.measure ⇒ Float
Measure time elapsed with a monotonic clock.
-
.now ⇒ Float
Current monotonic time.
Class Method Details
.measure ⇒ Float
Measure time elapsed with a monotonic clock
58 59 60 61 62 63 |
# File 'lib/benchmark/perf/clock.rb', line 58 def measure before = now yield after = now after - before end |
.now ⇒ Float
Current monotonic time
48 49 50 |
# File 'lib/benchmark/perf/clock.rb', line 48 def now MONOTONIC_CLOCK.now end |