utils
Class StopWatch

java.lang.Object
  extended by utils.StopWatch

public class StopWatch
extends java.lang.Object


Constructor Summary
StopWatch()
           
 
Method Summary
static long benchMark(java.lang.Runnable r, int n)
          Run the runnable r n times and return the average time in ms.
 void clear()
          Zero the elapsedTime
 double getElapsedTime()
          This is the time between a mark and a record.
 long getTimeInMs()
          This returns the elapsed time in MS
static void main(java.lang.String[] args)
           
 void print(double N, java.lang.String message)
           
 void print(java.lang.String message)
           
 void report()
          Report the elapsed time between the mark and the record invocations to the System.out.
 void report(java.io.PrintStream ps)
          Reports the elapsed time in seconds.
 void reset()
           
 void start()
          record the current time in milliseconds
 void stop()
          Compute the difference between the mark'd time and the current time, in milliseconds.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopWatch

public StopWatch()
Method Detail

reset

public void reset()

start

public void start()
record the current time in milliseconds


clear

public void clear()
Zero the elapsedTime


stop

public void stop()
Compute the difference between the mark'd time and the current time, in milliseconds. The record method computes the elapsed_time.


getElapsedTime

public double getElapsedTime()
This is the time between a mark and a record.

Returns:
the time in seconds as a float

getTimeInMs

public long getTimeInMs()
This returns the elapsed time in MS

Returns:
a long in ms for the elapsed time.

benchMark

public static long benchMark(java.lang.Runnable r,
                             int n)
Run the runnable r n times and return the average time in ms.

Parameters:
r -
n -
Returns:

report

public void report(java.io.PrintStream ps)
Reports the elapsed time in seconds.

Parameters:
ps - outputs to the printstream

main

public static void main(java.lang.String[] args)

report

public void report()
Report the elapsed time between the mark and the record invocations to the System.out. Reports the elapsed time in seconds.


print

public void print(double N,
                  java.lang.String message)

print

public void print(java.lang.String message)