Module: Perfgate::Instrumentation::Duration
- Defined in:
- lib/perfgate/instrumentation/duration.rb
Overview
Wall-clock duration of a Perfgate.measure block (spec section
13.1). Uses a monotonic clock so NTP adjustments and system clock
changes never produce a negative or inflated reading.
Class Method Summary collapse
Class Method Details
.finish(started_at) ⇒ Object
15 16 17 |
# File 'lib/perfgate/instrumentation/duration.rb', line 15 def finish(started_at) { "duration_ns" => ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - started_at) * 1_000_000_000).round } end |
.start ⇒ Object
11 12 13 |
# File 'lib/perfgate/instrumentation/duration.rb', line 11 def start Process.clock_gettime(Process::CLOCK_MONOTONIC) end |