@InterfaceAudience.Private public class WindowMovingAverage<T> extends MovingAverage<T>
Modifier and Type | Field and Description |
---|---|
protected static int |
DEFAULT_SIZE |
protected long[] |
lastN |
protected int |
mostRecent |
protected boolean |
oneRound |
label
Constructor and Description |
---|
WindowMovingAverage(String label) |
WindowMovingAverage(String label,
int size) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
enoughStatistics()
Check if there are enough statistics.
|
double |
getAverageTime()
Get average execution time of the measured method.
|
protected int |
getMostRecentPosition()
Returns index of most recent
|
protected int |
getNumberOfStatistics()
Returns number of statistics
|
protected long |
getStatisticsAtIndex(int index)
Get statistics at index.
|
protected int |
moveForwardMostRecentPosition()
Move forward the most recent index.
|
private long |
sum(int bound) |
protected void |
updateMostRecentTime(long elapsed)
Update the most recent data.
|
measure, start, stop
protected static final int DEFAULT_SIZE
protected long[] lastN
protected int mostRecent
protected boolean oneRound
public WindowMovingAverage(String label)
public WindowMovingAverage(String label, int size)
protected void updateMostRecentTime(long elapsed)
MovingAverage
updateMostRecentTime
in class MovingAverage<T>
elapsed
- elapsed time of the most recent measurementpublic double getAverageTime()
MovingAverage
getAverageTime
in class MovingAverage<T>
protected boolean enoughStatistics()
protected int getNumberOfStatistics()
protected long getStatisticsAtIndex(int index)
index
- index of bar nprotected int getMostRecentPosition()
protected int moveForwardMostRecentPosition()
private long sum(int bound)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.