|
Open Model Railroad Network (OpenMRN)
|
Exponentially weighted moving average. More...
#include <Ewma.hxx>
Public Member Functions | |
| AbsEwma (float alpha) | |
| void | set_alpha (float alpha) |
| Sets the adjustment parameter. | |
| void | add_value (float value) |
| Adds a step to the EWMA average. | |
| void | reset_state (float value) |
| Clears the history and sets the state of the EWMA. | |
| float | avg () |
Public Attributes | |
| float | alpha_ |
| coefficient for EWMA | |
| float | avg_ {0.0} |
| current state of EWMA | |
Exponentially weighted moving average.
This class allows an O(1) representation of an average over a timeseries of data. This is the algorithm that Linux is using for the loadavg calculation. The algorithm is parametrized by a coefficient \alpha. The larger \alpha is, the longer "memory" the average has, meaning that the slower the average adapts to a changing situation.
|
inline |
|
inline |
|
inline |
|
inline |