@InterfaceAudience.Private public class ExponentialMovingAverage<T> extends WindowMovingAverage<T>
WeightedMovingAverage in weighted, but the weighting factor decrease
exponentially. It brings benefits that it is more sensitive, and can see the trends easily.| Modifier and Type | Field and Description |
|---|---|
private double |
alpha |
private double |
currentAverage |
private double |
previousAverage |
DEFAULT_SIZE, lastN, mostRecent, oneRoundlabel| Constructor and Description |
|---|
ExponentialMovingAverage(String label) |
ExponentialMovingAverage(String label,
double alpha) |
ExponentialMovingAverage(String label,
int size) |
ExponentialMovingAverage(String label,
int size,
double alpha) |
| Modifier and Type | Method and Description |
|---|---|
double |
getAverageTime()
Get average execution time of the measured method.
|
(package private) double |
getPrevious() |
void |
updateMostRecentTime(long elapsed)
Update the most recent data.
|
enoughStatistics, getMostRecentPosition, getNumberOfStatistics, getStatisticsAtIndex, moveForwardMostRecentPositionmeasure, start, stopprivate double alpha
private double previousAverage
private double currentAverage
public ExponentialMovingAverage(String label)
public ExponentialMovingAverage(String label, double alpha)
public ExponentialMovingAverage(String label, int size)
public ExponentialMovingAverage(String label, int size, double alpha)
public void updateMostRecentTime(long elapsed)
MovingAverageupdateMostRecentTime in class WindowMovingAverage<T>elapsed - elapsed time of the most recent measurementpublic double getAverageTime()
MovingAveragegetAverageTime in class WindowMovingAverage<T>double getPrevious()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.