Class: Serf::Middleware::RequestTimer::Timer
- Inherits:
-
Object
- Object
- Serf::Middleware::RequestTimer::Timer
- Defined in:
- lib/serf/middleware/request_timer.rb
Instance Attribute Summary collapse
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
-
#initialize ⇒ Timer
constructor
A new instance of Timer.
- #mark ⇒ Object
- #now ⇒ Object
Constructor Details
#initialize ⇒ Timer
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_time ⇒ Object (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
#mark ⇒ Object
37 38 39 |
# File 'lib/serf/middleware/request_timer.rb', line 37 def mark (now - @start_time).to_i end |
#now ⇒ Object
41 42 43 |
# File 'lib/serf/middleware/request_timer.rb', line 41 def now Time.now.to_f * 1_000_000 end |