com.anthonyeden.lib.util
Class Stopwatch

java.lang.Object
  extended bycom.anthonyeden.lib.util.Stopwatch

public class Stopwatch
extends java.lang.Object

Simple class for starting and stopping a stopwatch. This class is useful for timing how long a particular block of code takes to execute.

Author:
Anthony Eden

Constructor Summary
Stopwatch()
           
 
Method Summary
 long getElapsedTime()
          Get the elapsed time for the stopwatch in milliseconds.
 void start()
          Start the stopwatch.
 void stop()
          Stop the stopwatch.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stopwatch

public Stopwatch()
Method Detail

start

public void start()
Start the stopwatch.

Throws:
java.lang.IllegalStateException - If the stopwatch is already running

stop

public void stop()
Stop the stopwatch.

Throws:
java.lang.IllegalStateException - If the stopwatch is not running

getElapsedTime

public long getElapsedTime()
Get the elapsed time for the stopwatch in milliseconds.

Returns:
The elapsed time in milliseconds
Throws:
java.lang.IllegalStateException - If the stopwatch is running


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.