Method: Hitimes::Stats#rate

Defined in:
lib/hitimes/stats.rb

#rateObject

call-seq:

stat.rate -> Float

Return the count divided by sum.

In many cases when Stats#update( value ) is called, the value is a unit of time, typically seconds or microseconds. #rate is a convenience for those times. In this case, where value is a unit if time, then count divided by sum is a useful value, i.e. something per unit of time.

In the case where value is a non-time related value, then the value returned by rate is not really useful.



90
91
92
93
94
# File 'lib/hitimes/stats.rb', line 90

def rate
  return 0.0 if @sum.zero?

  @count / @sum
end