@InterfaceAudience.Private public class ExponentialMovingAverage extends WindowMovingAverage
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, oneRound
label
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, getMostRecentPosistion, getNumberOfStatistics, getStatisticsAtIndex, moveForwardMostRecentPosistion
measure, start, stop
private 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)
MovingAverage
updateMostRecentTime
in class WindowMovingAverage
elapsed
- elapsed time of the most recent measurementpublic double getAverageTime()
MovingAverage
getAverageTime
in class WindowMovingAverage
double getPrevious()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.