metrics-0.3.0.1: High-performance application metric tracking

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Metrics.MovingAverage

Description

A pure moving average module. The interface is agnostic to the scale of time that the average is tracking. It is up to the specific moving average module to handle that functionality.

Synopsis

Documentation

data MovingAverage Source

This type encapsulates the interface of the different moving average implementations in such a way that they can be reused without plumbing the types through the other components that use moving averages. Most people won't ever need to use record fields of this type.

Constructors

forall s . MovingAverage 

Fields

movingAverageClear :: !(s -> s)

clear the internal state of the moving average

movingAverageUpdate :: !(Double -> s -> s)

add a new sample to the moving average

movingAverageTick :: !(s -> s)

perform any modifications of the internal state associated with the passage of a predefined interval of time.

movingAverageRate :: !(s -> Double)

get the current rate of the moving average.

movingAverageState :: !s

the internal implementation state of the moving average

clear :: MovingAverage -> MovingAverage Source

Reset a moving average back to a starting state.

rate :: MovingAverage -> Double Source

Get the current rate of the moving average.

tick :: MovingAverage -> MovingAverage Source

Update the average based upon an interval specified by the moving average implementation.

update :: Double -> MovingAverage -> MovingAverage Source

Update the average with the specified value.