metrics-0.4.0.1: High-performance application metric tracking

Safe HaskellNone
LanguageHaskell2010

Data.Metrics.MovingAverage.ExponentiallyWeighted

Description

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

Synopsis

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 :: MovingAverage Source #

Create a new MovingAverage with 5 second tick intervals for a one-minute window.

new5MinuteMovingAverage :: MovingAverage Source #

Create a new MovingAverage with 5 second tick intervals for a five-minute window.

new15MinuteMovingAverage :: MovingAverage Source #

Create a new MovingAverage with 5 second tick intervals for a fifteen-minute window.

movingAverage :: Double -> Minutes -> MovingAverage Source #

Create a new MovingAverage with the given tick interval and averaging window.

rate :: ExponentiallyWeightedMovingAverage -> Double Source #

Get the current rate of the ExponentiallyWeightedMovingAverage for the given window.

empty Source #

Arguments

:: 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 -> ExponentiallyWeightedMovingAverage Source #

Update the moving average based upon the given value

tick :: ExponentiallyWeightedMovingAverage -> ExponentiallyWeightedMovingAverage Source #

Update the moving average as if the given interval between ticks has passed.