|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.util.AbstractChrono
public abstract class AbstractChrono
AbstractChrono
AbstractChrono is a class that acts as an interface to the system clock and calculates the CPU or system time consumed by parts of a program.
Every object of class AbstractChrono acts as an independent stopwatch. Several AbstractChrono objects can run at any given time. The method init resets the stopwatch to zero, getSeconds, getMinutes and getHours return its current reading, and format converts this reading to a String. The returned value includes the execution time of the method from AbstractChrono.
Below is an example of how it may be used.
A stopwatch named timer is constructed (and initialized).
When 2.1 seconds of CPU time have been consumed,
the stopwatch is read and reset to zero.
Then, after an additional 330 seconds (or 5.5 minutes) of CPU time,
the stopwatch is read again and the value is printed to the output
in minutes.
Constructor Summary | |
---|---|
AbstractChrono()
|
Method Summary | |
---|---|
String |
format()
. |
static String |
format(double time)
. |
double |
getHours()
. |
double |
getMinutes()
. |
double |
getSeconds()
. |
void |
init()
. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractChrono()
Method Detail |
---|
public void init()
public double getSeconds()
public double getMinutes()
public double getHours()
public String format()
public static String format(double time)
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |