Module: Brpoplpush::RedisScript::Timing
- Included in:
- Client
- Defined in:
- lib/brpoplpush/redis_script/timing.rb
Overview
Handles timing> of things
Class Method Summary collapse
-
.now ⇒ Float
Returns a float representation of the current time.
-
.timed ⇒ yield return, Float
Used for timing method calls.
Class Method Details
.now ⇒ Float
Returns a float representation of the current time.
Either from Process or Time
30 31 32 |
# File 'lib/brpoplpush/redis_script/timing.rb', line 30 def now (Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i end |
.timed ⇒ yield return, Float
Used for timing method calls
17 18 19 20 21 |
# File 'lib/brpoplpush/redis_script/timing.rb', line 17 def timed start_time = now [yield, now - start_time] end |