public final class SlidingPercentile extends Object
SlidingPercentile can be used for bandwidth estimation based on a sliding window of past download rate observations. This is an alternative to sliding mean and exponential averaging which suffer from susceptibility to outliers and slow adaptation to step functions.
Constructor and Description |
---|
SlidingPercentile(int maxWeight) |
Modifier and Type | Method and Description |
---|---|
void |
addSample(int weight,
float value)
Record a new observation.
|
float |
getPercentile(float percentile)
Compute the percentile by integration.
|
public void addSample(int weight, float value)
weight
- The weight of the new observation.value
- The value of the new observation.public float getPercentile(float percentile)
percentile
- The desired percentile, expressed as a fraction in the range (0,1].