Class: Serf::Middleware::RequestTimer::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/serf/middleware/request_timer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTimer

Returns a new instance of Timer.



33
34
35
# File 'lib/serf/middleware/request_timer.rb', line 33

def initialize
  @start_time = now
end

Instance Attribute Details

#start_timeObject (readonly)

Returns the value of attribute start_time.



27
28
29
# File 'lib/serf/middleware/request_timer.rb', line 27

def start_time
  @start_time
end

Instance Method Details

#markObject



37
38
39
# File 'lib/serf/middleware/request_timer.rb', line 37

def mark
  (now - @start_time).to_i
end

#nowObject



41
42
43
# File 'lib/serf/middleware/request_timer.rb', line 41

def now
  Time.now.to_f * 1_000_000
end