public class SlidingPercentile
extends java.lang.Object
This class can be used for bandwidth estimation based on a sliding window of past transfer 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)
Adds a new weighted value.
|
float |
getPercentile(float percentile)
Computes a percentile by integration.
|
void |
reset()
Resets the sliding percentile.
|
public SlidingPercentile(int maxWeight)
maxWeight - The maximum weight.public void reset()
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].Float.NaN if no samples have been added.