module SidekiqUniqueJobs::Timing
Handles timing of things
@author Mikael Henriksson <mikael@mhenrixon.com>
Public Instance Methods
Source
# File lib/sidekiq_unique_jobs/timing.rb, line 50 def clock_stamp if Process.const_defined?(:CLOCK_MONOTONIC) Process.clock_gettime(Process::CLOCK_MONOTONIC) else now_f end end
Returns a float representation of the current time.
Either from Process or Time
@return [Float]
Source
# File lib/sidekiq_unique_jobs/timing.rb, line 39 def now_f SidekiqUniqueJobs.now_f end
Returns the current time as float
@see SidekiqUniqueJobs.now_f
@return [Float]
Source
# File lib/sidekiq_unique_jobs/timing.rb, line 28 def time_source -> { (clock_stamp * 1000).to_i } end
Used to get a current representation of time as Integer
@return [Integer]
Source
# File lib/sidekiq_unique_jobs/timing.rb, line 16 def timed start_time = time_source.call [yield, time_source.call - start_time] end
Used for timing method calls
@return [yield return, Float]