| java.lang.Object org.hsqldb.lib.StopWatch
StopWatch | public class StopWatch (Code) | | 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.
author: boucherb@users version: 1.7.2 since: 1.7.2 |
Field Summary | |
boolean | running Flags if this object is started or stopped. |
Method Summary | |
public long | currentElapsedTime() Retrieves the accumulated time this object has spent running since
it was last started. | public String | currentElapsedTimeToMessage(String prefix) | public long | elapsedTime() Retrieves the accumulated time this object has spent running since
it was last zeroed. | public String | elapsedTimeToMessage(String prefix) | public void | mark() | public void | start() Ensures that this object is in the running state. | public void | stop() Ensures that this object is in the stopped state. | public String | toString() Retrieves the internal state of this object, as a String. | public void | zero() Zeros accumulated running time and restarts this object. |
running | boolean running(Code) | | Flags if this object is started or stopped.
|
StopWatch | public StopWatch()(Code) | | Creates, zeros, and starts a new StopWatch
|
StopWatch | public StopWatch(boolean start)(Code) | | Creates, zeros, and starts a new StopWatch
|
currentElapsedTime | public long currentElapsedTime()(Code) | | Retrieves the accumulated time this object has spent running since
it was last started.
the accumulated time this object has spent running sinceit was last started. |
currentElapsedTimeToMessage | public String currentElapsedTimeToMessage(String prefix)(Code) | | Retrieves prefix + " in " + elapsedTime() + " ms."
Parameters: prefix - The string to use as a prefix prefix + " in " + elapsedTime() + " ms." |
elapsedTime | public long elapsedTime()(Code) | | Retrieves the accumulated time this object has spent running since
it was last zeroed.
the accumulated time this object has spent running sinceit was last zeroed. |
elapsedTimeToMessage | public String elapsedTimeToMessage(String prefix)(Code) | | Retrieves prefix + " in " + elapsedTime() + " ms."
Parameters: prefix - The string to use as a prefix prefix + " in " + elapsedTime() + " ms." |
start | public void start()(Code) | | Ensures that this object is in the running state. If this object is not
running, then the call has the effect of setting the startTime
attribute to the current value of System.currentTimeMillis() and setting
the running attribute to true .
|
stop | public void stop()(Code) | | Ensures that this object is in the stopped state. If this object is
in the running state, then this has the effect of adding to the
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.
|
toString | public String toString()(Code) | | Retrieves the internal state of this object, as a String.
The retreived value is:
super.toString() +
"[running=" +
running +
", startTime=" +
startTime +
", total=" +
total + "]";
the state of this object, as a String |
zero | public void zero()(Code) | | Zeros accumulated running time and restarts this object.
|
|
|