jimm.evote
Class StopWatch

java.lang.Object
  extended byjimm.evote.StopWatch

public class StopWatch
extends java.lang.Object

Prints time durations; used for development purposes and foolin' around.

No threads or system resources are harmed in the making of a stop watch. A stop watch simply remembers the start time (and elapsed time when paused) and prints the total running time (wall clock time) when stopped.


Field Summary
protected  long elapsedTime
           
protected  java.lang.String name
           
protected  long t0
           
 
Constructor Summary
StopWatch()
          Constructor.
StopWatch(java.lang.String name)
          Constructor.
 
Method Summary
 void mark()
          Prints the current elapsed time without stopping.
 void mark(boolean printMark)
          Prints the current elapsed time without stopping, along with the stop watch name if printMark is true.
 void pause()
          Pauses the stop watch.
 void resume()
          Resumes the stop watch.
 void start()
          Remembers the current time.
 void start(boolean printStarting)
          Remembers the current time and prints a message if requested.
 void stop()
          Stops the stop watch and prints the current elapsed time.
 void stop(boolean printName)
          Stops the stop watch and prints the current elapsed time, along with the stop watch name if printMark is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

t0

protected long t0

elapsedTime

protected long elapsedTime
Constructor Detail

StopWatch

public StopWatch()
Constructor.


StopWatch

public StopWatch(java.lang.String name)
Constructor.

Parameters:
name - identifying text
Method Detail

start

public void start()
Remembers the current time.


start

public void start(boolean printStarting)
Remembers the current time and prints a message if requested.

Parameters:
printStarting - if true and this stop watch has a name, print a message

pause

public void pause()
Pauses the stop watch.


resume

public void resume()
Resumes the stop watch.


mark

public void mark()
Prints the current elapsed time without stopping.


mark

public void mark(boolean printMark)
Prints the current elapsed time without stopping, along with the stop watch name if printMark is true.

Parameters:
printMark - if true, the stop watch name will be printed

stop

public void stop()
Stops the stop watch and prints the current elapsed time.


stop

public void stop(boolean printName)
Stops the stop watch and prints the current elapsed time, along with the stop watch name if printMark is true.

Parameters:
printName - if true, the stop watch name will be printed


Copyright (c) 2004 by Jim Menard jimm@io.com