|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.esa.beam.util.StopWatch
public class StopWatch
The StopWatch class is a (very) simple utility class that allows to measure the time passed between two
user defined events.
...
private final StopWatch stopWatch = new StopWatch();
...
void doATimeConsumingThing() {
stopWatch.start();
...
stopWatch.end();
Debug.trace("Time needed: " + stopWatch);
}
...
| Constructor Summary | |
|---|---|
StopWatch()
Construct a new stop watch object. |
|
| Method Summary | |
|---|---|
long |
getEndTime()
Gets the user defined end time in milliseconds (the one that was set when the stop() method was
called). |
long |
getStartTime()
Gets the user defined start time in milliseconds (the one that was set when the start() method was
called). |
long |
getTimeDiff()
Gets the elapsed time between start time and end time. |
String |
getTimeDiffString()
Returns the elapsed time between start and end as a string in the format "hours:minutes:seconds", with seconds given as a decimal floating point number. |
static String |
getTimeString(long millis)
Utility method that converts a given time in milliseconds in the format "hours:minutes:seconds", with seconds given as a decimal floating point number. |
void |
start()
Defines the start time by calling java.lang.System.currentTimeMillis(). |
void |
stop()
Defines the end time by calling java.lang.System.currentTimeMillis(). |
void |
stopAndTrace(String label)
|
String |
toString()
Return a string representation of the elapsed time by calling getTimeDiffString(). |
void |
trace(String label)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StopWatch()
start().
| Method Detail |
|---|
public void start()
java.lang.System.currentTimeMillis().
public void stop()
java.lang.System.currentTimeMillis().
public long getStartTime()
start() method was
called).
public long getEndTime()
stop() method was
called).
public long getTimeDiff()
public String getTimeDiffString()
public static String getTimeString(long millis)
millis - the time in milliseconds
public String toString()
getTimeDiffString().
toString in class Objectpublic void stopAndTrace(String label)
public void trace(String label)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||