adaptj.util
Class AdaptJTimer

java.lang.Object
  |
  +--adaptj.util.AdaptJTimer

public class AdaptJTimer
extends java.lang.Object

Utility class providing a timer. Used for profiling various operations.

Author:
Bruno Dufour

Constructor Summary
AdaptJTimer()
          Creates a new timer with the default name, which is "unnamed".
AdaptJTimer(java.lang.String name)
          Creates a new timer with the given name.
 
Method Summary
 long getTime()
          Returns the cumulative duration for this timer.
 void start()
          Starts the given timer.
 void stop()
          Stops the current timer.
 java.lang.String toString()
          Returns a string represeantation of this timer, which is simply the name of this timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdaptJTimer

public AdaptJTimer(java.lang.String name)
Creates a new timer with the given name.

Parameters:
name - the name of the new timer

AdaptJTimer

public AdaptJTimer()
Creates a new timer with the default name, which is "unnamed".

Method Detail

start

public void start()
Starts the given timer.


toString

public java.lang.String toString()
Returns a string represeantation of this timer, which is simply the name of this timer.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of this timer

stop

public void stop()
Stops the current timer.


getTime

public long getTime()
Returns the cumulative duration for this timer. This value is the total time this timer has spent in the enabled state.

Returns:
the cumulative duration of this timer, as a long