org.processmining.framework.util
Class StopWatch

java.lang.Object
  extended by org.processmining.framework.util.StopWatch

public class StopWatch
extends java.lang.Object

Provides a simple timer facility, to measure the duration of tasks.

Author:
Christian W. Guenther (christian at deckfour dot org)

Field Summary
static long DAY
           
protected  long finish
          Keeps the finish date
static long HOUR
           
static long MINUTE
           
static long SECOND
          Constants encoding the duration of time units in millisconds.
protected  long start
          Keeps the start date
 
Constructor Summary
StopWatch()
          Creates a new timer instance
 
Method Summary
 java.lang.String formatDuration()
          Retrieves the duration as a human-readable string
static java.lang.String formatDuration(long timeInMillis)
          Formats a duration, given in milliseconds, to a human-readable string (verbose)
 long getDuration()
          Retrieves the duration
 java.util.Date getFinishDate()
          Retrieves the finish date
 java.util.Date getStartDate()
          Retrieves the start date
 void start()
          Starts measuring the duration (sets start time)
 long stop()
          Finishes measuring the duration (sets finish time)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECOND

public static final long SECOND
Constants encoding the duration of time units in millisconds.

See Also:
Constant Field Values

MINUTE

public static final long MINUTE
See Also:
Constant Field Values

HOUR

public static final long HOUR
See Also:
Constant Field Values

DAY

public static final long DAY
See Also:
Constant Field Values

start

protected long start
Keeps the start date


finish

protected long finish
Keeps the finish date

Constructor Detail

StopWatch

public StopWatch()
Creates a new timer instance

Method Detail

formatDuration

public static java.lang.String formatDuration(long timeInMillis)
Formats a duration, given in milliseconds, to a human-readable string (verbose)

Parameters:
timeInMillis -
Returns:

start

public void start()
Starts measuring the duration (sets start time)


stop

public long stop()
Finishes measuring the duration (sets finish time)


getStartDate

public java.util.Date getStartDate()
Retrieves the start date

Returns:
the start date

getFinishDate

public java.util.Date getFinishDate()
Retrieves the finish date

Returns:
the finish date

getDuration

public long getDuration()
Retrieves the duration

Returns:
the duration

formatDuration

public java.lang.String formatDuration()
Retrieves the duration as a human-readable string

Returns:
the duration as a human-readable string