Safe Haskell | None |
---|
An exponentially-weighted moving average.
see UNIX Load Average Part 1: How It Works:
http://www.teamquest.com/pdfs/whitepaper/ldavg1.pdf
see UNIX Load Average Part 2: Not Your Average Average
http://www.teamquest.com/pdfs/whitepaper/ldavg2.pdf
see Wikipedia's article on exponential moving averages:
http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average
- data ExponentiallyWeightedMovingAverage
- new1MinuteMovingAverage :: MovingAverage
- new5MinuteMovingAverage :: MovingAverage
- new15MinuteMovingAverage :: MovingAverage
- movingAverage :: Double -> Minutes -> MovingAverage
- clear :: ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverage
- rate :: ExponentiallyWeightedMovingAverage -> Double
- empty :: Double -> Minutes -> ExponentiallyWeightedMovingAverage
- update :: Double -> ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverage
- tick :: ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverage
Documentation
data ExponentiallyWeightedMovingAverage Source
The internal representation of the exponentially weighted moving average.
This type encapsulates the state needed for the exponentially weighted MovingAverage implementation.
new1MinuteMovingAverage :: MovingAverageSource
Create a new MovingAverage with 5 second tick intervals for a one-minute window.
new5MinuteMovingAverage :: MovingAverageSource
Create a new MovingAverage with 5 second tick intervals for a five-minute window.
new15MinuteMovingAverage :: MovingAverageSource
Create a new MovingAverage with 5 second tick intervals for a fifteen-minute window.
movingAverage :: Double -> Minutes -> MovingAverageSource
Create a new MovingAverage with the given tick interval and averaging window.
clear :: ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverageSource
Reset the moving average rate to zero.
rate :: ExponentiallyWeightedMovingAverage -> DoubleSource
Get the current rate of the ExponentiallyWeightedMovingAverage for the given window.
:: Double | The interval in seconds between ticks |
-> Minutes | The duration in minutes which the moving average covers |
-> ExponentiallyWeightedMovingAverage |
Create a new ExpontiallyWeightedMovingAverage with the given tick interval and averaging window.
update :: Double -> ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverageSource
Update the moving average based upon the given value
tick :: ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverageSource
Update the moving average as if the given interval between ticks has passed.