adolfo_filter Class Reference
[Filters]

#include <AdolfoFilter.h>

Inheritance diagram for adolfo_filter:

Inheritance graph
[legend]
Collaboration diagram for adolfo_filter:

Collaboration graph
[legend]

List of all members.


Detailed Description

provides an average bandwidth over a window of time, under an assumption of a fixed-size data packet.

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.

The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:26 2008 for Mace Library by  doxygen 1.5.5