public class SILTimer
extends java.lang.Object
SILTimer
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.
JRWG: Unsure why both SILTimer and JATimer are needed as JARP uses SILConstructor and Description |
---|
SILTimer()
Constructs a new timer and sets its interval start value
to the current system time.
|
SILTimer(org.apache.logging.log4j.Logger log,
org.apache.logging.log4j.Level lev,
org.apache.logging.log4j.Marker mark)
Constructs a new timer and sets its interval start value
to the current system time.
|
Modifier and Type | Method and Description |
---|---|
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, i.e.
|
void |
setDisplayDisabled(boolean da)
Sets the value of this timer's display-disabled flag: any
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.
|
public SILTimer()
public SILTimer(org.apache.logging.log4j.Logger log, org.apache.logging.log4j.Level lev, org.apache.logging.log4j.Marker mark)
public void setDisplayDisabled(boolean da)
public void start()
public long getTimeNow()
System.nanotime()
.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.