public class StopWatch extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
protected int |
count
The lap count
|
protected boolean |
running
Is the watch started
|
protected long |
start
Start time
|
protected long |
stop
Stop time
|
protected long |
total
Total time
|
Constructor and Description |
---|
StopWatch()
Default constructor.
|
StopWatch(boolean running)
Construct a StopWatch.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Return a cloned copy of this object.
|
long |
getAverageLapTime()
Get the average lap time since the watch was started.
|
int |
getLapCount()
Get the lap count.
|
long |
getLapTime()
Get the elapsed lap time since the watch was started.
|
long |
getTime()
Get the elapsed time since the watch was created or last reset.
|
boolean |
isRunning()
Check if the watch is running.
|
static StopWatch |
makeSynchronized(StopWatch watch)
Return a synchronized stop watch.
|
void |
reset()
Reset the watch.
|
void |
start()
Start the watch.
|
void |
start(boolean reset)
Start the watch.
|
long |
stop()
Stop the watch.
|
String |
toString()
Return a string representation.
|
protected long total
protected long start
protected long stop
protected int count
protected boolean running
public StopWatch()
public StopWatch(boolean running)
running
- Start the watchpublic void start(boolean reset)
reset
- True to reset the watch prior to starting.public void start()
public long stop()
public void reset()
public int getLapCount()
public long getLapTime()
public long getAverageLapTime()
public long getTime()
public boolean isRunning()
public String toString()
public Object clone()
Copyright © 2018 JBoss by Red Hat. All rights reserved.