public class Timer
extends java.lang.Object
Constructor and Description |
---|
Timer()
Anonymous, not running (timing).
|
Timer(boolean running)
Anonymous, running as specified.
|
Timer(java.lang.String id)
Named, not running (timing).
|
Timer(java.lang.String id,
boolean running)
Named, running as specified.
|
Modifier and Type | Method and Description |
---|---|
void |
error(java.lang.String msg)
Throw a RuntimeException.
|
long |
lastTime()
Time since the last
start() in milliseconds
to the subsequent stop(), if any, otherwise to 'now'. |
long |
markTime()
|
long |
meanTime()
Mean time in milliseconds of all periods of 'running'.
|
void |
start()
Start the clock.
|
void |
stop()
Stop (pause) 'this' running Timer and add the
time since its last
start() to its total. |
java.lang.String |
toString() |
long |
totalTime()
|
public Timer()
public Timer(java.lang.String id)
public Timer(boolean running)
public Timer(java.lang.String id, boolean running)
public void start()
stop()
first.public void stop()
start()
to its total.public long markTime()
public long lastTime()
start()
in milliseconds
to the subsequent stop(), if any, otherwise to 'now'.
Note, it does not do a stop()
.
Also see markTime()
.public long totalTime()
public long meanTime()
public void error(java.lang.String msg)
public java.lang.String toString()
toString
in class java.lang.Object