Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ibatis.common.util
Class Stopwatch  view Stopwatch download Stopwatch.java

java.lang.Object
  extended bycom.ibatis.common.util.Stopwatch

public class Stopwatch
extends java.lang.Object

This class is used for testing...how else could it be used? You tell us. ;-)


Nested Class Summary
private  class Stopwatch.TaskStat
           
 
Field Summary
private  java.lang.String currentTaskName
           
private  long currentTaskTime
           
private static org.apache.commons.logging.Log log
           
private  java.util.Map taskMap
           
 
Constructor Summary
Stopwatch()
           
 
Method Summary
private  void appendTaskTime(java.lang.String taskName, long taskTime)
           
 long getAvgTaskTime(java.lang.String taskName)
          Get the average time added to a task
 long getMaxTaskTime(java.lang.String taskName)
          Get the maximum time added to a task
 long getMinTaskTime(java.lang.String taskName)
          Get the minimum time added to a task
 long getTaskCount(java.lang.String taskName)
          Get the number of times assigned to a task
 java.util.Iterator getTaskNames()
          Get an iterator of the tasks
 long getTotalTaskTime(java.lang.String taskName)
          Get the total time added to a task
 void mergeStopwatch(Stopwatch watch)
          Merge another StopWatch into this one
 void reset()
          Reset all of the timers in this StopWatch
 void start(java.lang.String taskName)
          Start (create) a task
 void stop()
          Stop the timer on a task
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

taskMap

private java.util.Map taskMap

currentTaskName

private java.lang.String currentTaskName

currentTaskTime

private long currentTaskTime
Constructor Detail

Stopwatch

public Stopwatch()
Method Detail

getTaskNames

public java.util.Iterator getTaskNames()
Get an iterator of the tasks


getTaskCount

public long getTaskCount(java.lang.String taskName)
Get the number of times assigned to a task


getTotalTaskTime

public long getTotalTaskTime(java.lang.String taskName)
Get the total time added to a task


getMaxTaskTime

public long getMaxTaskTime(java.lang.String taskName)
Get the maximum time added to a task


getMinTaskTime

public long getMinTaskTime(java.lang.String taskName)
Get the minimum time added to a task


getAvgTaskTime

public long getAvgTaskTime(java.lang.String taskName)
Get the average time added to a task


start

public void start(java.lang.String taskName)
Start (create) a task


stop

public void stop()
Stop the timer on a task


appendTaskTime

private void appendTaskTime(java.lang.String taskName,
                            long taskTime)

mergeStopwatch

public void mergeStopwatch(Stopwatch watch)
Merge another StopWatch into this one


reset

public void reset()
Reset all of the timers in this StopWatch


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).