Method: Hitimes::Stats#update

Defined in:
lib/hitimes/stats.rb

#update(value) ⇒ Object

call-seq:

stat.update( val ) -> val

Update the running stats with the new value. Return the input value.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/hitimes/stats.rb', line 53

def update(value)
  @mutex.synchronize do
    @min = (value < @min) ? value : @min
    @max = (value > @max) ? value : @max

    @count += 1
    @sum   += value
    @sumsq += (value * value)
  end

  value
end