public 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 |
getApproximateTiming()
Return an approximation of the total time spent between consecutive calls of #start and #stop.
|
long |
getCount()
Return the number of times that
start() has been called. |
void |
start()
Start the timer.
|
void |
stop()
Stop the timer.
|
public final void start()
public final void stop()
public final long getCount()
start()
has been called.public final long getApproximateTiming()