|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.metamatrix.core.util.Stopwatch
public class Stopwatch
Nested Class Summary | |
---|---|
class |
Stopwatch.Statistics
|
Constructor Summary | |
---|---|
Stopwatch()
|
Method Summary | |
---|---|
float |
getAverageDuration()
Return the average duration recorded as a date. |
int |
getSegmentCount()
Return the number of segments that have been recorded. |
java.lang.String |
getTimeValueAsString(float value)
|
java.lang.String |
getTimeValueAsString(long value)
|
long |
getTotalDuration()
Return the total duration recorded, in milliseconds. |
java.lang.String |
getValueAsString(int value)
|
boolean |
isActive()
Return whether the stopwatch is active. |
static void |
logTimedMessage(java.lang.String message,
long time,
Logger log)
Logs a message containing a time increment in milliseconds and a messages describing the operation or context that the time relates to. |
void |
printStatistics()
Print the current statistics to System.out |
void |
printStatistics(java.io.PrintStream stream)
Print the current statistics |
void |
reset()
Reset the statistics for this stopwatch, regardless of the active state. |
void |
setActive()
Set the stopwatch as active. |
void |
setInactive()
Set the stopwatch as inactive. |
void |
start()
If the stopwatch is active, record the starting time for a time segment. |
void |
start(boolean reset)
If the stopwatch is active, record the starting time for a time segment. |
void |
stop()
If the stopwatch is active, record the ending time for a time segment. |
void |
stopLogIncrementAndRestart(java.lang.String message,
Logger log)
This convience method stops the current stopwatch, logs a message containing the resulting time increment/duration and restarts the stopwatch. |
void |
stopPrintIncrementAndRestart(java.lang.String message)
This convience method stops the current stopwatch, prints a message to System.out containing the resulting time increment/duration and restarts the stopwatch. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Stopwatch()
Method Detail |
---|
public boolean isActive()
start
and stop
)
and will print duration statistics (via printDuration
).
When the stopwatch is inactive, invoking these methods does nothing
but return immediately.
public void setInactive()
isActive
public void setActive()
isActive
public void start()
isActive
public void start(boolean reset)
isActive
public void stop()
isActive
public void reset()
public long getTotalDuration()
public float getAverageDuration()
public int getSegmentCount()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getTimeValueAsString(long value)
public java.lang.String getTimeValueAsString(float value)
public java.lang.String getValueAsString(int value)
public void printStatistics(java.io.PrintStream stream)
stream
- the stream to which the statistics should be printedpublic void printStatistics()
public static void logTimedMessage(java.lang.String message, long time, Logger log)
message
- time
- public void stopLogIncrementAndRestart(java.lang.String message, Logger log)
message
- public void stopPrintIncrementAndRestart(java.lang.String message)
message
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |