Module: BucketStore::Timing

Defined in:
lib/bucket_store/timing.rb

Class Method Summary collapse

Class Method Details

.monotonic_nowFloat

“Wall clock is for telling time, monotonic clock is for measuring time.”

When timing events, ensure we ask for a monotonically adjusted clock time to avoid changes to the system time from being reflected in our measurements.

See this article for a good explanation and a deeper dive: blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/

Returns:

  • (Float)


15
16
17
# File 'lib/bucket_store/timing.rb', line 15

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