Header for stats.c.
More...
Go to the source code of this file.
Header for stats.c.
Definition in file stats.h.
◆ DEFAULT_STATS_N_EWMA_COUNT
#define DEFAULT_STATS_N_EWMA_COUNT 100 |
◆ stats_update_running_avg
#define stats_update_running_avg |
( |
|
avg, |
|
|
|
value |
|
) |
| n_count_ewma_double(avg, value, DEFAULT_STATS_N_EWMA_COUNT) |
◆ n_count_ewma_double()
static double n_count_ewma_double |
( |
double |
avg, |
|
|
double |
value, |
|
|
uint64_t |
N |
|
) |
| |
|
inlinestatic |
Compute an N-count EWMA, aka N-EWMA. N-EWMA is defined as: EWMA = alpha*value + (1-alpha)*EWMA_prev with alpha = 2/(N+1).
This works out to: EWMA = value*2/(N+1) + EMA_prev*(N-1)/(N+1) = (value*2 + EWMA_prev*(N-1))/(N+1)
Definition at line 23 of file stats.h.