Package org.apache.hadoop.hbase.util
Class WindowMovingAverage<T>
java.lang.Object
org.apache.hadoop.hbase.util.MovingAverage<T>
org.apache.hadoop.hbase.util.WindowMovingAverage<T>
- Direct Known Subclasses:
ExponentialMovingAverage
,WeightedMovingAverage
Instead of calculate a whole time average, this class focus on the last N. The last N is stored
in a circle array.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected long[]
protected int
protected boolean
Fields inherited from class org.apache.hadoop.hbase.util.MovingAverage
label
-
Constructor Summary
ConstructorDescriptionWindowMovingAverage
(String label) WindowMovingAverage
(String label, int size) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Check if there are enough statistics.double
Get average execution time of the measured method.protected int
Returns index of most recentprotected int
Returns number of statisticsprotected long
getStatisticsAtIndex
(int index) Get statistics at index.protected int
Move forward the most recent index.private long
sum
(int bound) protected void
updateMostRecentTime
(long elapsed) Update the most recent data.Methods inherited from class org.apache.hadoop.hbase.util.MovingAverage
measure, start, stop
-
Field Details
-
DEFAULT_SIZE
- See Also:
-
lastN
-
mostRecent
-
oneRound
-
-
Constructor Details
-
WindowMovingAverage
-
WindowMovingAverage
-
-
Method Details
-
updateMostRecentTime
Description copied from class:MovingAverage
Update the most recent data.- Specified by:
updateMostRecentTime
in classMovingAverage<T>
- Parameters:
elapsed
- elapsed time of the most recent measurement
-
getAverageTime
Description copied from class:MovingAverage
Get average execution time of the measured method.- Specified by:
getAverageTime
in classMovingAverage<T>
- Returns:
- average time in ns
-
enoughStatistics
Check if there are enough statistics.- Returns:
- true if lastN is full
-
getNumberOfStatistics
Returns number of statistics -
getStatisticsAtIndex
Get statistics at index.- Parameters:
index
- index of bar
-
getMostRecentPosition
Returns index of most recent -
moveForwardMostRecentPosition
Move forward the most recent index.- Returns:
- the most recent index
-
sum
-