Module: SidekiqUniqueJobs::Script::Timing

Included in:
Client
Defined in:
lib/sidekiq_unique_jobs/script/timing.rb

Overview

Handles timing> of things

Author:

Class Method Summary collapse

Class Method Details

.nowFloat

Returns a float representation of the current time.

Either from Process or Time

Returns:

  • (Float)


30
31
32
# File 'lib/sidekiq_unique_jobs/script/timing.rb', line 30

def now
  (Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i
end

.timedyield return, Float

Used for timing method calls

Returns:

  • (yield return, Float)


17
18
19
20
21
# File 'lib/sidekiq_unique_jobs/script/timing.rb', line 17

def timed
  start_time = now

  [yield, now - start_time]
end