abstract class AbstractRateStatistic extends java.lang.Object implements RateStatistic
Provides exponentially decaying moving average functionality to subclasses.
Modifier and Type | Field and Description |
---|---|
private long |
rateAveragePeriod |
Constructor and Description |
---|
AbstractRateStatistic(long averagePeriod,
java.util.concurrent.TimeUnit unit)
Create an abstract statistic using the specified time averaging period.
|
Modifier and Type | Method and Description |
---|---|
private double |
alpha(long now,
long then) |
(package private) long |
getRateAveragePeriod()
Returns the time averaging period in nanoseconds.
|
(package private) float |
iterateMovingAverage(float nowValue,
long now,
float thenAverage,
long then)
Combines two timestamped values using a exponentially decaying weighted average.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
event, getCount, getRate
AbstractRateStatistic(long averagePeriod, java.util.concurrent.TimeUnit unit)
averagePeriod
- average periodunit
- period time unitlong getRateAveragePeriod()
float iterateMovingAverage(float nowValue, long now, float thenAverage, long then)
nowValue
- current valuenow
- current value timestampthenAverage
- previous valuethen
- previous value timestampprivate double alpha(long now, long then)