Class StatisticDurationTracker
java.lang.Object
org.apache.hadoop.util.OperationDuration
org.apache.hadoop.fs.statistics.impl.StatisticDurationTracker
- All Implemented Interfaces:
AutoCloseable,DurationTracker
Track the duration of an object.
When closed the
min/max/mean statistics are updated.
In the constructor, the counter with name of 'key' is
incremented -default is by 1, but can be set to other
values, including 0.
-
Constructor Summary
ConstructorsConstructorDescriptionStatisticDurationTracker(IOStatisticsStore iostats, String key) Constructor -increments the counter by 1.StatisticDurationTracker(IOStatisticsStore iostats, String key, long count) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Set the finished time and then update the statistics.voidfailed()The operation failed.toString()Return the duration asOperationDuration.humanTime(long).Methods inherited from class org.apache.hadoop.util.OperationDuration
asDuration, finished, getDurationString, humanTime, time, valueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.fs.statistics.DurationTracker
asDuration
-
Constructor Details
-
StatisticDurationTracker
Constructor -increments the counter by 1.- Parameters:
iostats- statistics to updatekey- prefix of values.
-
StatisticDurationTracker
Constructor. If the supplied count is greater than zero, the counter of the key name is updated.- Parameters:
iostats- statistics to updatekey- Key to use as prefix of values.count- #of times to increment the matching counter.
-
-
Method Details
-
failed
public void failed()Description copied from interface:DurationTrackerThe operation failed. Failure statistics will be updated.- Specified by:
failedin interfaceDurationTracker
-
close
public void close()Set the finished time and then update the statistics. If the operation failed then the key + .failures counter will be incremented by one. The operation min/mean/max values will be updated with the duration; on a failure these will all be the .failures metrics.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDurationTracker
-
toString
Description copied from class:OperationDurationReturn the duration asOperationDuration.humanTime(long).- Overrides:
toStringin classOperationDuration- Returns:
- a printable duration.
-