35#ifndef _UTILS_EWMA_HXX_
36#define _UTILS_EWMA_HXX_
111 clock_gettime(CLOCK_REALTIME, &ts);
112 t = ts.tv_sec * 1000000000;
Exponentially weighted moving average.
void set_alpha(float alpha)
Sets the adjustment parameter.
float avg_
current state of EWMA
float alpha_
coefficient for EWMA
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.
Exponentially weighted moving average.
long long current_time()
Helper function to get the current time.
void add_diff(uint32_t bytes)
Notifies the average algorithm that since the last call ‘bytes’ additional bytes were transferred.
float alpha_
coefficient for EWMA
uint32_t lastOffset_
What was the progress offset at the time of the last measurement taken.
float avg_
current state of EWMA
Ewma(float alpha=0.8)
Constructor.
void add_absolute(uint32_t offset)
Sets the absolute value where the transfer is.
long long lastMeasurementTimeNsec_
When did we take the last measurement.
long long os_get_time_monotonic(void)
Get the monotonic time since the system started.