|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.interface21.util.StopWatch
Simple stop watch, allowing for timing of a number of
tasks, exposing total running time and running time for each
named task.
Note that this object is not designed to be threadsafe, and does not
use synchronization or threading. Therefore it is safe to invoke it from EJBs.
This class is normally used to verify performance during proof-of-concepts
and in development, rather than as part of production applications.
| Inner Class Summary | |
class |
StopWatch.TaskInfo
Inner class to hold data about one task |
| Constructor Summary | |
StopWatch()
Construct a new stop watch. |
|
StopWatch(java.lang.String id)
Construct a new stop watch with the given id Does not start any task. |
|
| Method Summary | |
long |
getLastInterval()
Return the time taken by the last operation |
int |
getTaskCount()
Return the number of tasks timed |
StopWatch.TaskInfo[] |
getTaskInfo()
Return an array of the data for tasks performed |
long |
getTotalTime()
Return the total time in milliseconds for all tasks |
double |
getTotalTimeSecs()
Return the total time in seconds for all tasks |
java.lang.String |
prettyPrint()
Return an informative string describing all tasks performed |
void |
start(java.lang.String task)
Start a named task. |
void |
stop()
Stop the current task. |
java.lang.String |
toString()
Return an informative string describing all tasks performed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public StopWatch()
public StopWatch(java.lang.String id)
id - identifier for this stop watch.
Handy when we have output from multiple stop watches and need to distinguish between them.| Method Detail |
public void start(java.lang.String task)
task - name of the task to startpublic void stop()
public long getTotalTime()
public long getLastInterval()
public double getTotalTimeSecs()
public int getTaskCount()
public StopWatch.TaskInfo[] getTaskInfo()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String prettyPrint()
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||