#include <AdolfoFilter.h>
One of the problems of the Filters design is that the API for each one is slightly different, and the base class doesn't really encapsulate the functionality very well. For example the update(double) function from the base class would set the value, but it would get overridden when getValue() is called, which would recompute the value based on the history list.
adolfo_filter uses a history list, and each time update() is called, the time is pushed onto the history list. When checking the value, any times older than the BANDWIDTH_WINDOW are removed. Then, the size of the list, multiplied by the 'data_packet_size' parameter, and divided by the window time (adjusted for proper units), is used as the value. The value is in bits per second.
Definition at line 65 of file AdolfoFilter.h.
Public Member Functions | |
void | update () |
Should be called each time a data packet is received. Assumed to all be the same size. | |
void | clear () |
resets the value to 0 | |
double | getValue () |
computes and returns the latest bandwidth window estimate | |
Static Public Attributes | |
static const int | BANDWIDTH_WINDOW_SBITS = 2 |
how long to keep average (seconds) in log of 2: 2^2 = 4 seconds | |
static const uint64_t | BANDWIDTH_WINDOW = (1<<BANDWIDTH_WINDOW_SBITS) * 1000*1000 |
how long to keep average in micro-seconds | |
Protected Member Functions | |
void | check () |
removes old values from the history and sets value. |