util

## Class SILTimer

- java.lang.Object
- - util.SILTimer

-     public class SILTimer
      extends java.lang.Object

  A `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 SIL

- - ### Constructor Summary

    Constructors
    Constructor 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.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SILTimer

          public SILTimer()

      Constructs a new timer and sets its interval start value to the current system time.

    - #### SILTimer

          public 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. Provides logger and logging Level and Marker.

  - ### Method Detail

    - #### setDisplayDisabled

          public 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.

    - #### start

          public void start()

      Sets this timer's interval start value to the current system time.

    - #### getTimeNow

          public long getTimeNow()

      Returns the current system time in nanoseconds, i.e. this is just a facade for `System.nanotime()`.

    - #### startAndGet

          public long startAndGet()

      Performs a "start" operation on this timer, and returns the interval start value (in nanoseconds) defined by that operation.

    - #### getTimeDeltaMS

          public 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.

    - #### getTimeMS

          public float getTimeMS()

      Returns the duration of the interval defined by this timer's "start" value and the present, the duration being measured in milliseconds.

    - #### getRelativeTimeMS

          public 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.

    - #### showGivenTimeMS

          public 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.

    - #### showTimeMS

          public 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.

    - #### showTimeMSAndRestart

          public 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.

    - #### showRelativeTimeMS

          public 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.

    - #### getAndShowTimeMS

          public float getAndShowTimeMS(java.lang.String tag)

      As for `showTimeMS(String)`, but this method also returns the displayed value.

    - #### getAndShowRelativeTimeMS

          public float getAndShowRelativeTimeMS(long tbase,
                                                java.lang.String tag)

      As for `showRelativeTimeMS(long, String)`, but this method also returns the displayed value.