@NotThreadSafe public final class StopWatch extends Object implements IStoppable, Serializable
System.nanoTime().| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEFAULT_START
By default the stop watch is not started automatically
|
| Constructor and Description |
|---|
StopWatch()
Create a new stop watch that is not yet started.
|
StopWatch(boolean bStart)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getMillis() |
long |
getNanos() |
long |
getSeconds() |
boolean |
isStarted() |
boolean |
isStopped() |
EChange |
reset()
Reset all saved durations, in case this stop watch is to be used in a loop.
|
void |
restart()
Stops, resets and starts the stop watch.
|
EChange |
start()
Start the stop watch.
|
EChange |
stop()
Stop the stop watch.
|
long |
stopAndGetMillis()
Stop the stop watch and get the elapsed milliseconds since the start.
|
long |
stopAndGetNanos()
Stop the stop watch and get the elapsed nanoseconds since the start.
|
long |
stopAndGetSeconds()
Stop the stop watch and get the elapsed seconds since the start.
|
String |
toString() |
public static final boolean DEFAULT_START
public StopWatch()
public StopWatch(boolean bStart)
bStart - if true the stop watch is directly started!@Nonnull public EChange reset()
EChange.@Nonnull public EChange stop()
stop in interface IStoppableEChange.CHANGED if the stop watch was previously running
and is now stopped, and EChange.UNCHANGED if the stop watch
was already stopped.public void restart()
public boolean isStarted()
true if the stop watch is currently started (running),
false otherwise.public boolean isStopped()
true if the stop watch is currently stopped (not
running), false otherwise.public long getNanos()
public long getMillis()
public long getSeconds()
public long stopAndGetNanos()
public long stopAndGetMillis()
public long stopAndGetSeconds()
Copyright © 2006–2014 phloc systems. All rights reserved.