public class Timer extends Object
Constructor and Description |
---|
Timer()
Constructs a new timer, initially not started.
|
Modifier and Type | Method and Description |
---|---|
Timer |
display()
Prints the elapsed time on System.out
|
double |
elapsedTime()
Same as seconds().
|
double |
millis()
Returns the elapsed time in milli seconds; does not stop the timer, if
started.
|
Timer |
minus(Timer other)
T = this - other; Constructs and returns a new timer which is
the difference of the receiver and the other timer.
|
double |
minutes()
Returns the elapsed time in minutes; does not stop the timer, if started.
|
long |
nanos()
Returns the elapsed time in nano seconds; does not stop the timer, if
started.
|
Timer |
plus(Timer other)
T = this + other; Constructs and returns a new timer which is
the sum of the receiver and the other timer.
|
Timer |
reset()
Resets the timer.
|
double |
seconds()
Returns the elapsed time in seconds; does not stop the timer, if started.
|
Timer |
start()
Starts the timer.
|
Timer |
stop()
Stops the timer.
|
static void |
test(int size)
Shows how to use a timer in convenient ways.
|
String |
toString()
Returns a String representation of the receiver.
|
public Timer()
public Timer display()
public double elapsedTime()
public double millis()
public long nanos()
public Timer minus(Timer other)
other
- the timer to subtract.public double minutes()
public Timer plus(Timer other)
other
- the timer to add.public Timer reset()
public double seconds()
public Timer start()
public Timer stop()
public static void test(int size)
Jump to the Parallel Colt Homepage