public class FunctionTimer
extends java.lang.Object
| Constructor and Description |
|---|
FunctionTimer()
Create a new FunctionTimer
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
averageTime()
Returns a string describing the average time, as returned by
getAverageTimeUsec(). |
double |
getAverageTimeUsec()
Returns the total time divided by the cycle count, in microseconds.
|
int |
getCycleCount()
|
double |
getResolutionUsec()
Returns the resolution of this timer, in microseconds.
|
double |
getTimeUsec()
Returns the elapsed time in microseconds.
|
double |
getTotalTimeUsec()
Returns the sum of all the elapsed times measured (in microseconds) since
the timer was created or
reset() was last called. |
void |
reset()
Sets the elapsed time, total time and cycle count to 0 and re-initializes
the start indicator.
|
void |
restart()
Marks the beginning of a new timing interval and leaves the elapsed time
unchanged.
|
java.lang.String |
result(int cnt)
Returns a string describing the current elapsed time, divided by the
supplied count parameter.
|
java.lang.String |
resultMsec(int cnt)
Returns a string describing the current elapsed time, divided by the
supplied count parameter.
|
java.lang.String |
resultUsec(int cnt)
Returns a string describing the current elapsed time, divided by the
supplied count parameter.
|
void |
start()
Marks the beginning of a new timing interval and sets the elapsed time to
0.
|
void |
stop()
|
public void start()
public void restart()
public void reset()
public void stop()
public double getTimeUsec()
If the timer is running (i.e., start or restart has been called but stop has not yet been called,
the associated time difference will not be included in the result.
public double getTotalTimeUsec()
reset() was last called.
If the timer is running (i.e., start or restart has been called but stop has not yet been called,
the associated time difference will not be included in the result.
public int getCycleCount()
start() followed by
stop(), with possible restart() calls in between) since the
timer was created or reset() was last called.public double getAverageTimeUsec()
getTotalTimeUsec() and getCycleCount().public double getResolutionUsec()
public java.lang.String result(int cnt)
cnt - count to divide the elapsed time bypublic java.lang.String averageTime()
getAverageTimeUsec(). The result is displayed in milliseconds, unless it
is less than 1 millisecond, in which case it is displayed in
microseconds.public java.lang.String resultUsec(int cnt)
cnt - count to divide the elapsed time bypublic java.lang.String resultMsec(int cnt)
cnt - count to divide the elapsed time by