ewe.util
Class OperationTimer

java.lang.Object
  extended byewe.util.OperationTimer

public class OperationTimer
extends Object

This class can be used to time the operation of a sequence of events to millisecond precision (up to the resolution of the underlying os).

You call the start() method to start timing and the end() method to end timing. You can then call the start() method again to time another event. You can also call start() repeatedly without calling end() - a start() method will always call end() for any previously started timings.

Call getEvents() to get an array of all the event names that were timed and getTimes() to get an array of the corresponding times. Call toString() to get a list of times for each event in seconds and ms.


Constructor Summary
OperationTimer()
           
 
Method Summary
 void end()
          End timing an operation and add the timed name and value to the list of stored times.
 String[] getEvents()
           
 long[] getTimes()
           
 void reset()
          Clear all the current timed values.
 void start(String operation)
          Start timing an operation, ending any previous operation.
 String toString()
          Return a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Constructor Detail

OperationTimer

public OperationTimer()
Method Detail

reset

public void reset()
Clear all the current timed values.


end

public void end()
End timing an operation and add the timed name and value to the list of stored times.


start

public void start(String operation)
Start timing an operation, ending any previous operation.


getEvents

public String[] getEvents()

getTimes

public long[] getTimes()

toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Overrides:
toString in class Object
Returns:
a String representing this object.