public final class Timer
extends java.lang.Object
start()
and stop()
methods should typically be called
in a try/finally clause with start()
being called right before the
try block and stop()
being called at the beginning of the finally
block:
timer.start(); try { // code to time } finally { timer.stop(); }
Constructor and Description |
---|
Timer() |
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Return the number of times that
start() has been called. |
long |
getTiming()
Return an approximation of the total time spend between consecutive calls of #start and #stop.
|
void |
start()
Start the timer.
|
void |
stop()
Stop the timer.
|
public void start()
public void stop()
public long getCount()
start()
has been called.public long getTiming()