public class ExponentialMovingAverageRatio extends Object
success()
or failure()
when an event occurs, and the ratio of success to total events
is accumulated. Older values are given exponentially smaller weight, with a decay factor determined by a duration
chosen by the client. The rate measurement weights decay in two dimensions:
weight = exp((t0-t)/T)
where t0
is the
last measurement time, t
is the current time and T
is the lapse period)weight = exp(-i/L)
where L
is
the lapse window and i
is the sequence number of the measurement.Constructor and Description |
---|
ExponentialMovingAverageRatio(double lapsePeriod,
int window) |
Modifier and Type | Method and Description |
---|---|
void |
failure()
Add a new event with failed outcome.
|
int |
getCount() |
double |
getMax() |
double |
getMean() |
double |
getMin() |
double |
getStandardDeviation() |
Statistics |
getStatistics() |
double |
getTimeSinceLastMeasurement() |
void |
reset() |
void |
success()
Add a new event with successful outcome.
|
String |
toString() |
public ExponentialMovingAverageRatio(double lapsePeriod, int window)
lapsePeriod
- the exponential lapse rate for the rate average (in seconds)window
- the exponential lapse window (number of measurements)public void success()
public void failure()
public void reset()
public int getCount()
public double getTimeSinceLastMeasurement()
public double getMean()
public double getStandardDeviation()
public double getMax()
public double getMin()
public Statistics getStatistics()