|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjautil.JATimer
public class JATimer
A JATimer provides (real-) time measurement, using the Java 5 nano-second System timer (whose resolution may well be less fine- grained than 1 ns.), to provide interval measures expressed in milliseconds (as values of type float). Each timer also has facilities for the display of real-time values.
Constructor Summary | |
---|---|
JATimer()
Constructs a new timer and sets its interval start value to the current system time. |
Method Summary | |
---|---|
float |
getAndShowRelativeTimeMS(long tbase,
java.lang.String tag)
As for showRelativeTimeMS(long, String) , but this
method also returns the displayed value. |
float |
getAndShowTimeMS(java.lang.String tag)
As for showTimeMS(String) , but this method also
returns the displayed value. |
float |
getRelativeTimeMS(long tbase)
Returns the duration of the interval defined by the given base value (measured in nanoseconds) and the present, the duration being measured in milliseconds. |
float |
getTimeDeltaMS(long tm0,
long tm1)
Returns the duration of the interval defined by the given pair of time values: the result is measured in milliseconds, while the inputs are measured in nanoseconds. |
float |
getTimeMS()
Returns the duration of the interval defined by this timer's "start" value and the present, the duration being measured in milliseconds. |
long |
getTimeNow()
Returns the current system time in nanoseconds (so this is just a wrapper for System.nanotime(). |
void |
setDisplayDisabled(boolean da)
Sets the value of this timer's display-disabled flag: request to display a time message will be ignored if (but only if) this flag is true. |
void |
showGivenTimeMS(float tms,
java.lang.String tag)
Displays the given (millisecond) time value, prefixed with the given tag string, as a line on standard output -- but does nothing if display is currently disabled on this timer. |
void |
showRelativeTimeMS(long tbase,
java.lang.String tag)
Displays the duration (in milliseconds) of the interval defined by this timer's "start" time and the present -- that is, the value given by getRelativeTimeMS(long)
-- prefixed with the given tag string, as a line on standard
output. |
void |
showTimeMS(java.lang.String tag)
Displays the duration (in milliseconds) of the current interval -- that is, the value given by getTimeMS() -- prefixed
with the given tag string, as a line on standard output. |
void |
showTimeMSAndRestart(java.lang.String tag)
Displays the duration (in milliseconds) of the current interval -- that is, the value given by getTimeMS() -- prefixed
with the given tag string, as a line on standard output; also
re-starts this timer before returning. |
void |
start()
Sets this timer's interval start value to the current system time. |
long |
startAndGet()
Performs a "start" operation on this timer, and returns the interval start value (in nanoseconds) defined by that operation. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JATimer()
Method Detail |
---|
public void setDisplayDisabled(boolean da)
public void start()
public long getTimeNow()
public long startAndGet()
public float getTimeDeltaMS(long tm0, long tm1)
public float getTimeMS()
public float getRelativeTimeMS(long tbase)
public void showGivenTimeMS(float tms, java.lang.String tag)
public void showTimeMS(java.lang.String tag)
getTimeMS()
-- prefixed
with the given tag string, as a line on standard output.
public void showTimeMSAndRestart(java.lang.String tag)
getTimeMS()
-- prefixed
with the given tag string, as a line on standard output; also
re-starts this timer before returning.
public void showRelativeTimeMS(long tbase, java.lang.String tag)
getRelativeTimeMS(long)
-- prefixed with the given tag string, as a line on standard
output.
public float getAndShowTimeMS(java.lang.String tag)
showTimeMS(String)
, but this method also
returns the displayed value.
public float getAndShowRelativeTimeMS(long tbase, java.lang.String tag)
showRelativeTimeMS(long, String)
, but this
method also returns the displayed value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |