FileDocCategorySizeDatePackage
Stopwatch.javaAPI DocExample956Sun Sep 02 14:59:04 BST 2001com.oreilly.javaxslt.util

Stopwatch

public class Stopwatch extends Object

Fields Summary
private long
startTime
private long
stopTime
private boolean
running
private int
numLaps
Constructors Summary
Methods Summary
public doublegetAverageTime()

        if (this.numLaps == 0) {
            return getElapsedTime();
        }
        return (double) getElapsedTime() / (double) numLaps;
    
public longgetElapsedTime()

        if (this.running) {
            return System.currentTimeMillis() - this.startTime;
        }
        return this.stopTime - this.startTime;
    
public voidlap()

        this.numLaps++;
    
public voidstart()

        this.running = true;
        this.numLaps = 0;
        this.startTime = System.currentTimeMillis();
    
public voidstop()

        this.stopTime = System.currentTimeMillis();
        this.running = false;
    
public java.lang.StringtoString()

        return getElapsedTime() + "ms";