org.globus.cog.util.timer
Class StopWatch

java.lang.Object
  extended byorg.globus.cog.util.timer.StopWatch

public class StopWatch
extends Object

A stopwatch to measure time.


Field Summary
static long[] timer
           
static String[] timerName
           
 
Constructor Summary
StopWatch(int n)
          Creates a new StopWatch instance.
 
Method Summary
 void add(int i, long time)
          The add method add the time to the timer i.
 void add(String name, long time)
          The add method add the time to timer "name".
 long get(int i)
          The get method gets the value of the timer with the given name check.
 int getIndex(String name)
          The getIndex method gets the index of the timer with the given name
 void init(int n)
          The init method creates n timers each timer has a default name "Time i" where i is a number between 1 and n.
 void pause(int i)
          The pause method pause the ith timer.
 void printTimer(int i)
          The printTimer method prints the ith timer result in seconds.
 void printTimer(String name)
          The printTimer method prints the ith timer result.
 void printTimers()
          Describe printTimers method prints all timer results.
 void reset(int i)
          The reset method resets the timer.
 void resume(int i)
          The resume method resumes the ith timer.
 void set(int i, String name)
          The set method sets the name of the ith timer.
 int size()
          The size method returns the number of timers.
 void start(int i)
          The start method starts the ith timer.
 void stop(int i)
          The stop method stops the ith timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timer

public static long[] timer

timerName

public static String[] timerName
Constructor Detail

StopWatch

public StopWatch(int n)
Creates a new StopWatch instance.

Parameters:
n - an int value
Method Detail

init

public void init(int n)
The init method creates n timers each timer has a default name "Time i" where i is a number between 1 and n.

Parameters:
n - an int value

reset

public void reset(int i)
The reset method resets the timer.

Parameters:
i - an int value

set

public void set(int i,
                String name)
The set method sets the name of the ith timer.

Parameters:
i - an int value
name - a String value

getIndex

public int getIndex(String name)
The getIndex method gets the index of the timer with the given name

Parameters:
name - a String value
Returns:
an int value

get

public long get(int i)
The get method gets the value of the timer with the given name check.

Parameters:
i - an int value
Returns:
a long value

add

public void add(int i,
                long time)
The add method add the time to the timer i.

Parameters:
i - an int value
time - a long value

add

public void add(String name,
                long time)
The add method add the time to timer "name".

Parameters:
name - a String value
time - a long value

size

public int size()
The size method returns the number of timers.

Returns:
an int value

start

public void start(int i)
The start method starts the ith timer.

Parameters:
i - an int value

stop

public void stop(int i)
The stop method stops the ith timer.

Parameters:
i - an int value

pause

public void pause(int i)
The pause method pause the ith timer.

Parameters:
i - an int value

resume

public void resume(int i)
The resume method resumes the ith timer.

Parameters:
i - an int value

printTimer

public void printTimer(int i)
The printTimer method prints the ith timer result in seconds.

Parameters:
i - an int value

printTimer

public void printTimer(String name)
The printTimer method prints the ith timer result.

Parameters:
name - a String value

printTimers

public void printTimers()
Describe printTimers method prints all timer results.