krati.util
Class Chronos

java.lang.Object
  extended by krati.util.Chronos

public class Chronos
extends Object

Chronos

Author:
jwu

Constructor Summary
Chronos()
          Constructor : initialize the tick and sets no stream
Chronos(PrintStream out)
          Constructor : initialize the tick and set the stream to the one given
 
Method Summary
 void displayElapsedTime()
          Display the time elapsed since the last call (with no message)
 void displayElapsedTime(String msg)
          Display the time elapsed since the last call (with an additional message)
 void flush()
          Flushes the underlying writer
 String getElapsedTime()
          Returns a string that represents the time elapsed since the last call
 long getTotalTime()
           
 void restart()
          Restarts this Chronos.
 long tick()
          Returns the number of milliseconds elapsed since the last call to this function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Chronos

public Chronos()
Constructor : initialize the tick and sets no stream


Chronos

public Chronos(PrintStream out)
Constructor : initialize the tick and set the stream to the one given

Parameters:
out - the print stream for the output
Method Detail

restart

public void restart()
Restarts this Chronos.


tick

public long tick()
Returns the number of milliseconds elapsed since the last call to this function.

Returns:
the number of milliseconds since last call

getTotalTime

public long getTotalTime()
Returns:
the total time since start of this Chronos

getElapsedTime

public String getElapsedTime()
Returns a string that represents the time elapsed since the last call

Returns:
the elapsed time as a string

displayElapsedTime

public void displayElapsedTime()
Display the time elapsed since the last call (with no message)


displayElapsedTime

public void displayElapsedTime(String msg)
Display the time elapsed since the last call (with an additional message)

Parameters:
msg - the message to display first

flush

public void flush()
Flushes the underlying writer



Copyright © 2011. All Rights Reserved.