com.ibm.team.fvt.tests.performance
Class Timer

java.lang.Object
  extended by com.ibm.team.fvt.tests.performance.Timer

public class Timer
extends java.lang.Object

Timer class, for gathering execution/response times.

The timer class allows for simple gathering of execution/response times in seconds. The class measures using nano time so there is no dependency on the system clock.


Constructor Summary
Timer()
           
 
Method Summary
 void end()
          End timer.
 long getTimeDateStamp()
          Return the time/date stamp taken when the timer last started.
 double getTotalTime()
          Return the total execution time as seconds.
 void reset()
          Reset timer values to 0.
static double round(double unrounded, int precision)
          Return the input double with precision places rounded up
 void start()
          Start timer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer()
Method Detail

start

public void start()
Start timer.


end

public void end()
End timer.


getTimeDateStamp

public long getTimeDateStamp()
Return the time/date stamp taken when the timer last started.

Returns:
The time/date stamp as a long.

getTotalTime

public double getTotalTime()
Return the total execution time as seconds. Note the code uses nano time and must divide by 1 billion to get seconds. We also use the decimal format class to crop the results to three places.

Returns:
The total execution time as a double.

reset

public void reset()
Reset timer values to 0.


round

public static double round(double unrounded,
                           int precision)
Return the input double with precision places rounded up

Returns:
The double rounded to precision places.