Package org.apache.hadoop.hbase.io.hfile
Class NanoTimer
java.lang.Object
org.apache.hadoop.hbase.io.hfile.NanoTimer
A nano-second timer.
 
Copied from hadoop-3315 tfile. Remove after tfile is committed and use the tfile version of this class instead.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanChecking whether the timer is startedstatic voidSimple tester.static StringnanoTimeToString(long t) A utility method to format a time duration in nano seconds into a human understandable stirng.longread()Read the timer.private booleanreadable()voidreset()Reset the timer.voidstart()Start the timer.voidstop()Stop the timer.toString()Format the elapsed time to a human understandable string.
- 
Field Details- 
last
- 
started
- 
cumulate
 
- 
- 
Constructor Details- 
NanoTimerConstructor Start the timer upon construction.
 
- 
- 
Method Details- 
startStart the timer. Note: No effect if timer is already started.
- 
stopStop the timer. Note: No effect if timer is already stopped.
- 
readRead the timer.- Returns:
- the elapsed time in nano-seconds. Note: If the timer is never started before, -1 is returned.
 
- 
resetReset the timer.
- 
isStartedChecking whether the timer is started- Returns:
- true if timer is started.
 
- 
toStringFormat the elapsed time to a human understandable string. Note: If timer is never started, "ERR" will be returned.
- 
nanoTimeToStringA utility method to format a time duration in nano seconds into a human understandable stirng. Time duration in nano seconds.- Returns:
- String representation.
 
- 
readable
- 
mainSimple tester.
 
-