org.LatencyUtils
Class MovingAverageIntervalEstimator
java.lang.Object
org.LatencyUtils.IntervalEstimator
org.LatencyUtils.MovingAverageIntervalEstimator
- Direct Known Subclasses:
- TimeCappedMovingAverageIntervalEstimator
public class MovingAverageIntervalEstimator
- extends IntervalEstimator
A moving average interval estimator. Estimates intervalEndTimes by averaging the interval values recorded in a
moving window. Will only provide average estimate once enough intervalEndTimes have been collected to fill the
window, and will return an impossibly long interval estimate until then.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MovingAverageIntervalEstimator
public MovingAverageIntervalEstimator(int requestedWindowLength)
- Parameters:
requestedWindowLength - The requested length of the moving window. May be rounded up to nearest power of 2.
recordInterval
public void recordInterval(long when)
- Description copied from class:
IntervalEstimator
- Record an interval
- Specified by:
recordInterval in class IntervalEstimator
- Parameters:
when - the end time (in nanoTime units) at which the interval was observed.
getEstimatedInterval
public long getEstimatedInterval(long when)
- Description copied from class:
IntervalEstimator
- Provides the estimated interval
- Specified by:
getEstimatedInterval in class IntervalEstimator
- Parameters:
when - the time (preferably now) at which the estimated interval is requested.
- Returns:
- estimated interval
Copyright © 2013. All rights reserved.