Based on the Spring StopWatch class, but supporting nested tasks
Modifiers | Name | Description |
---|---|---|
static class |
StopWatch.TaskInfo |
Inner class to hold data about one task executed within the stop watch. |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
complete() |
|
StopWatch.TaskInfo |
getLastTaskInfo() Return the last task as a TaskInfo object. |
|
java.lang.String |
getLastTaskName() Return the name of the last task. |
|
long |
getLastTaskTimeMillis() Return the time taken by the last task. |
|
int |
getTaskCount() Return the number of tasks timed. |
|
StopWatch.TaskInfo[] |
getTaskInfo() Return an array of the data for tasks performed. |
|
long |
getTotalTimeMillis() Return the total time in milliseconds for all tasks. |
|
double |
getTotalTimeSeconds() Return the total time in seconds for all tasks. |
|
boolean |
isRunning() Return whether the stop watch is currently running. |
|
java.lang.String |
prettyPrint() Return a string with a table describing all tasks performed. |
|
java.lang.String |
shortSummary() Return a short description of the total running time. |
|
void |
start() Start an unnamed task. |
|
void |
start(java.lang.String taskName) Start a named task. |
|
void |
stop() Stop the current task. |
|
java.lang.String |
toString() Return an informative string describing all tasks performed For custom reporting, call getTaskInfo() and use the task info directly. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Construct a new stop watch. Does not start any task.
Construct a new stop watch with the given id. Does not start any task.
id
- identifier for this stop watch.
Handy when we have output from multiple stop watches
and need to distinguish between them.Return the last task as a TaskInfo object.
Return the name of the last task.
Return the time taken by the last task.
Return the number of tasks timed.
Return an array of the data for tasks performed.
Return the total time in milliseconds for all tasks.
Return the total time in seconds for all tasks.
Return whether the stop watch is currently running.
Return a string with a table describing all tasks performed. For custom reporting, call getTaskInfo() and use the task info directly.
Return a short description of the total running time.
Start an unnamed task. The results are undefined if stop() or timing methods are called without invoking this method.
Start a named task. The results are undefined if stop() or timing methods are called without invoking this method.
taskName
- the name of the task to startStop the current task. The results are undefined if timing methods are called without invoking at least one pair start() / stop() methods.
Return an informative string describing all tasks performed
For custom reporting, call getTaskInfo()
and use the task info directly.