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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checking whether the timer is startedstatic void
Simple tester.static String
nanoTimeToString
(long t) A utility method to format a time duration in nano seconds into a human understandable stirng.long
read()
Read the timer.private boolean
readable()
void
reset()
Reset the timer.void
start()
Start the timer.void
stop()
Stop the timer.toString()
Format the elapsed time to a human understandable string.
-
Field Details
-
last
-
started
-
cumulate
-
-
Constructor Details
-
NanoTimer
Constructor Start the timer upon construction.
-
-
Method Details
-
start
Start the timer. Note: No effect if timer is already started. -
stop
Stop the timer. Note: No effect if timer is already stopped. -
read
Read the timer.- Returns:
- the elapsed time in nano-seconds. Note: If the timer is never started before, -1 is returned.
-
reset
Reset the timer. -
isStarted
Checking whether the timer is started- Returns:
- true if timer is started.
-
toString
Format the elapsed time to a human understandable string. Note: If timer is never started, "ERR" will be returned. -
nanoTimeToString
A utility method to format a time duration in nano seconds into a human understandable stirng. Time duration in nano seconds.- Returns:
- String representation.
-
readable
-
main
Simple tester.
-