module Airbrake::MonotonicTime
MonotonicTime
is a helper for getting monotonic time suitable for performance measurements. It guarantees that the time is strictly linearly increasing (unlike realtime).
@example
MonotonicTime.time_in_ms #=> 287138801.144576
@see pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html @since v4.2.4 @api private
Public Class Methods
time_in_ms()
click to toggle source
@return [Integer] current monotonic time in milliseconds
# File lib/airbrake-ruby/monotonic_time.rb, line 15 def time_in_ms time_in_nanoseconds / (10.0**6) end
time_in_s()
click to toggle source
@return [Integer] current monotonic time in seconds
# File lib/airbrake-ruby/monotonic_time.rb, line 20 def time_in_s time_in_nanoseconds / (10.0**9) end
Private Class Methods
time_in_nanoseconds()
click to toggle source
# File lib/airbrake-ruby/monotonic_time.rb, line 28 def time_in_nanoseconds Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) end