module Brpoplpush::RedisScript::Timing

Handles timing> of things

@author Mikael Henriksson <mikael@mhenrixon.com>

Public Instance Methods

now() click to toggle source

Returns a float representation of the current time.

Either from Process or Time

@return [Float]

# File lib/brpoplpush/redis_script/timing.rb, line 30
def now
  (Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i
end
timed() { || ... } click to toggle source

Used for timing method calls

@return [yield return, Float]

# File lib/brpoplpush/redis_script/timing.rb, line 17
def timed
  start_time = now

  [yield, now - start_time]
end