public class NanoTimer extends Object
Copied from hadoop-3315 tfile. Remove after tfile is committed and use the tfile version of this class instead.
Modifier and Type | Field and Description |
---|---|
private long |
cumulate |
private long |
last |
private boolean |
started |
Constructor and Description |
---|
NanoTimer(boolean start)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
isStarted()
Checking whether the timer is started
|
static void |
main(String[] args)
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.
|
String |
toString()
Format the elapsed time to a human understandable string.
|
public NanoTimer(boolean start)
start
- Start the timer upon construction.public void start()
public void stop()
public long read()
public void reset()
public boolean isStarted()
public String toString()
public static String nanoTimeToString(long t)
t
- Time duration in nano seconds.private boolean readable()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.