Class: Metrics::Instruments::PostProcessMeter
- Defined in:
- lib/ruby-metrics/instruments/post_process_meter.rb
Constant Summary
Constants inherited from Meter
Meter::FIFTEEN_MINUTE_FACTOR, Meter::FIVE_MINUTE_FACTOR, Meter::INTERVAL, Meter::INTERVAL_IN_NS, Meter::ONE_MINUTE_FACTOR
Instance Attribute Summary
Attributes inherited from Meter
Instance Method Summary collapse
-
#initialize ⇒ PostProcessMeter
constructor
A new instance of PostProcessMeter.
- #interval_difference(timestamp) ⇒ Object
- #mark(timestamp, count = 1) ⇒ Object
Methods inherited from Meter
#as_json, #calc_rate, #clear, #fifteen_minute_rate, #five_minute_rate, #mean_rate, #one_minute_rate, #tick, #to_json
Methods included from TimeConversion
Constructor Details
#initialize ⇒ PostProcessMeter
Returns a new instance of PostProcessMeter.
6 7 8 |
# File 'lib/ruby-metrics/instruments/post_process_meter.rb', line 6 def initialize super(:no_thread => true) end |
Instance Method Details
#interval_difference(timestamp) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/ruby-metrics/instruments/post_process_meter.rb', line 19 def interval_difference() if @interval_start (( - @interval_start) % INTERVAL).to_i else @interval_start = 0 end end |
#mark(timestamp, count = 1) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ruby-metrics/instruments/post_process_meter.rb', line 10 def mark(, count = 1) ticks = interval_difference() if ticks > 0 ticks.times { self.tick } @interval_start = @interval_start + INTERVAL * ticks end @count += count end |