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
FieldsModifier and TypeFieldDescriptionprotected static final intprotected long[]protected intprotected booleanFields inherited from class org.apache.hadoop.hbase.util.MovingAverage
label -
Constructor Summary
ConstructorsConstructorDescriptionWindowMovingAverage(String label) WindowMovingAverage(String label, int size) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCheck if there are enough statistics.doubleGet average execution time of the measured method.protected intReturns index of most recentprotected intReturns number of statisticsprotected longgetStatisticsAtIndex(int index) Get statistics at index.protected intMove forward the most recent index.private longsum(int bound) protected voidupdateMostRecentTime(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:MovingAverageUpdate the most recent data.- Specified by:
updateMostRecentTimein classMovingAverage<T>- Parameters:
elapsed- elapsed time of the most recent measurement
-
getAverageTime
Description copied from class:MovingAverageGet average execution time of the measured method.- Specified by:
getAverageTimein 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
-