|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.lib.StopWatch
Provides the programatic analog of a physical stop watch.
The watch can be started, stopped and zeroed and can be queried for elapsed running time. The watch accumulates elapsed time over starts and stops such that only the time actually spent running is recorded. If the watch is zeroed, then the accumulated time is discarded and the watch starts again with zero acumulated time.
Constructor Summary | |
StopWatch()
Creates, zeros, and starts a new StopWatch |
|
StopWatch(boolean start)
Creates, zeros, and starts a new StopWatch |
Method Summary | |
long |
currentElapsedTime()
Retrieves the accumulated time this object has spent running since it was last started. |
String |
currentElapsedTimeToMessage(String prefix)
Retrieves prefix + " in " + elapsedTime() + " ms." |
long |
elapsedTime()
Retrieves the accumulated time this object has spent running since it was last zeroed. |
String |
elapsedTimeToMessage(String prefix)
Retrieves prefix + " in " + elapsedTime() + " ms." |
void |
mark()
|
void |
start()
Ensures that this object is in the running state. |
void |
stop()
Ensures that this object is in the stopped state. |
String |
toString()
Retrieves the internal state of this object, as a String. |
void |
zero()
Zeros accumulated running time and restarts this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StopWatch()
public StopWatch(boolean start)
Method Detail |
public long elapsedTime()
public long currentElapsedTime()
public void zero()
public void start()
startTime
attribute to the current value of System.currentTimeMillis() and setting
the running
attribute to true
.
public void stop()
total
attribute the elapsed time since the last transition
from stopped to running state and sets the running
attribute
to false. If this object is not in the running state, this call has no
effect.
public void mark()
public String elapsedTimeToMessage(String prefix)
prefix
- The string to use as a prefix
public String currentElapsedTimeToMessage(String prefix)
prefix
- The string to use as a prefix
public String toString()
super.toString() + "[running=" + running + ", startTime=" + startTime + ", total=" + total + "]";
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |