net.sourceforge.domian.util
Class StopWatch

java.lang.Object
  extended by net.sourceforge.domian.util.StopWatch

public class StopWatch
extends java.lang.Object

Nanosecond stop watch with some timely overhead... This class is not thread-safe.

Since:
0.3
Author:
Eirik Torske

Nested Class Summary
(package private) static class StopWatch.State
           
 
Field Summary
private  java.util.List<java.lang.Long> elapsedTimeIntervalList
           
private  long lastLapTime
           
private  long startTime
           
private  StopWatch.State state
           
private  long stopTime
           
 
Constructor Summary
StopWatch()
           
 
Method Summary
 java.lang.String elapsedTimeToString()
           
 long getElapsedTime()
           
 long getLapTime()
           
 StopWatch.State getState()
           
 java.lang.String lapTimeToString()
           
static java.lang.String print(long elapsedTime)
          NB!
 StopWatch reset()
           
 StopWatch start()
           
 StopWatch stop()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startTime

private long startTime

lastLapTime

private long lastLapTime

stopTime

private long stopTime

state

private StopWatch.State state

elapsedTimeIntervalList

private final java.util.List<java.lang.Long> elapsedTimeIntervalList
Constructor Detail

StopWatch

public StopWatch()
Method Detail

getState

public StopWatch.State getState()

reset

public StopWatch reset()

start

public StopWatch start()

stop

public StopWatch stop()

getElapsedTime

public long getElapsedTime()

getLapTime

public long getLapTime()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

elapsedTimeToString

public java.lang.String elapsedTimeToString()

lapTimeToString

public java.lang.String lapTimeToString()

print

public static java.lang.String print(long elapsedTime)
NB! Rounding mode is plain flooring.



Copyright © 2009-2010. All Rights Reserved.