com.h3c.sdn.metric

## Class TimeStampedRatioGauge

- java.lang.Object
- - com.codahale.metrics.RatioGauge
  - - com.h3c.sdn.metric.TimeStampedRatioGauge

- All Implemented Interfaces:
    com.codahale.metrics.Gauge<Double>, com.codahale.metrics.Metric, TimeStampedMetric

      public class TimeStampedRatioGauge
      extends com.codahale.metrics.RatioGauge
      implements TimeStampedMetric

  Extension of Coda Hale `RatioGauge` class that provides an association of the `RatioGauge` value with time stamps.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.codahale.metrics.RatioGauge

      `com.codahale.metrics.RatioGauge.Ratio`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `UNINITIALIZED` Value used to indicate that this `TimeStampedRatioGauge` has not yet been initialized.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeStampedRatioGauge(MetricRegistry registry, RatioGaugeDescriptor descriptor)` Constructs a `TimeStampedRatioGauge` with the specified characteristics using the specified `MetricRegistry`.
    `TimeStampedRatioGauge(MetricRegistry registry, RatioGaugeDescriptor descriptor, String uid)` Constructs a `TimeStampedRatioGauge` with the specified UID and other characteristics using the specified `MetricRegistry`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RatioGaugeDataPoint` | `extractDataPoint()` Extract a `RatioGaugeDataPoint` from this object.
    `double` | `getDenominator()` Gets the denominator of this `TimeStampedRatioGauge`.
    `RatioGaugeDescriptor` | `getDescriptor()` Gets the `MetricDescriptor` that describes this `TimeStampedMetric` object.
    `long` | `getMsSpanned()` Determines the number of milliseconds spanned between the latest (update) time stamp and the oldest (previous) time stamp, accounting for roll-over of the time stamp.
    `double` | `getNumerator()` Gets the numerator of this `TimeStampedRatioGauge`.
    `long` | `getPreviousTimeStamp()` Gets the previous time stamp.
    `protected com.codahale.metrics.RatioGauge.Ratio` | `getRatio()`
    `protected TimeStampManager` | `getTimeStampManager()` Gets the `TimeStampManager` that this object uses to manage its associated time stamps.
    `String` | `getUid()` Gets the UID.
    `long` | `getUpdateTimeStamp()` Gets the update time stamp.
    `void` | `reset()` Prepares the ratio gauge for use in a new time period by saving the most recent update time stamp as the previous time stamp.
    `void` | `setDenominator(double toSet)` Sets the denominator of this `TimeStampedRatioGauge`.
    `void` | `setDescriptor(RatioGaugeDescriptor toSet)` Sets the `RatioGaugeDescriptor` that specifies characteristics of this `TimeStampedRatioGauge`.
    `void` | `setNumerator(double toSet)` Sets the numerator of this `TimeStampedRatioGauge`.
    `void` | `setPreviousTimeStamp(long time)` Sets the previous time stamp.
    `void` | `setUid(String toSet)` Sets the UID of this object.
    `void` | `setUpdateTimeStamp(long time)` Sets the update time stamp.
    `String` | `toDebugString()` Gets a detailed representation of this object to facilitate debugging.
    `String` | `toString()`
    `void` | `update(double numerator, double denominator)` Sets the numerator and denominator of this `TimeStampedRatioGauge`.
    `void` | `updateDenominator(double toSet)` Sets the denominator of this `TimeStampedRatioGauge`.
    `void` | `updateNumerator(double toSet)` Sets the numerator of this `TimeStampedRatioGauge`.
    `void` | `updateTimeStamp()` Convenience method that sets the update time stamp to the current time.

    - ### Methods inherited from class com.codahale.metrics.RatioGauge

      `getValue`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### UNINITIALIZED

          public static final double UNINITIALIZED

      Value used to indicate that this `TimeStampedRatioGauge` has not yet been initialized.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimeStampedRatioGauge

          public TimeStampedRatioGauge(MetricRegistry registry,
                               RatioGaugeDescriptor descriptor)

      Constructs a `TimeStampedRatioGauge` with the specified characteristics using the specified `MetricRegistry`.
      Parameters:
        `registry` - `MetricRegistry` to use for allocating this object
        `descriptor` - `RatioGaugeDescriptor` that specifies various characteristics of the resulting `TimeStampedRatioGauge`

    - #### TimeStampedRatioGauge

          public TimeStampedRatioGauge(MetricRegistry registry,
                               RatioGaugeDescriptor descriptor,
                               String uid)

      Constructs a `TimeStampedRatioGauge` with the specified UID and other characteristics using the specified `MetricRegistry`.
      Parameters:
        `registry` - `MetricRegistry` to use for allocating this object
        `descriptor` - `RatioGaugeDescriptor` that specifies various characteristics of the resulting `TimeStampedRatioGauge`
        `uid` - UID to assign to the resulting `TimeStampedRatioGauge`
      Throws:
        `IllegalArgumentException` - if a null value is supplied for either the `RatioGaugeDescriptor` or `MetricRegistry` argument

  - ### Method Detail

    - #### extractDataPoint

          public RatioGaugeDataPoint extractDataPoint()

      Extract a `RatioGaugeDataPoint` from this object.
      Specified by:
        `extractDataPoint` in interface `TimeStampedMetric`
      Returns:
        the current value of this object represented as a `RatioGaugeDataPoint`

    - #### getDenominator

          public double getDenominator()

      Gets the denominator of this `TimeStampedRatioGauge`.
      Returns:
        the denominator for this object

    - #### getDescriptor

          public RatioGaugeDescriptor getDescriptor()

      Description copied from interface: `TimeStampedMetric`
      Gets the `MetricDescriptor` that describes this `TimeStampedMetric` object.
      Specified by:
        `getDescriptor` in interface `TimeStampedMetric`
      Returns:
        `MetricDescriptor` that describes this `TimeStampedMetric`

    - #### getMsSpanned

          public long getMsSpanned()

      Description copied from interface: `TimeStampedMetric`
      Determines the number of milliseconds spanned between the latest (update) time stamp and the oldest (previous) time stamp, accounting for roll-over of the time stamp.
      Specified by:
        `getMsSpanned` in interface `TimeStampedMetric`
      Returns:
        milliseconds spanned between the update and previous time stamps

    - #### getNumerator

          public double getNumerator()

      Gets the numerator of this `TimeStampedRatioGauge`.
      Returns:
        the numerator for this object

    - #### getPreviousTimeStamp

          public long getPreviousTimeStamp()

      Description copied from interface: `TimeStampedMetric`
      Gets the previous time stamp.
      Specified by:
        `getPreviousTimeStamp` in interface `TimeStampedMetric`
      Returns:
        previous time stamp

    - #### getRatio

          protected com.codahale.metrics.RatioGauge.Ratio getRatio()

      Specified by:
        `getRatio` in class `com.codahale.metrics.RatioGauge`

    - #### getTimeStampManager

          protected TimeStampManager getTimeStampManager()

      Gets the `TimeStampManager` that this object uses to manage its associated time stamps.
      Returns:
        the `TimeStampManager` for this object

    - #### getUid

          public String getUid()

      Description copied from interface: `TimeStampedMetric`
      Gets the UID.
      Specified by:
        `getUid` in interface `TimeStampedMetric`
      Returns:
        the UID

    - #### getUpdateTimeStamp

          public long getUpdateTimeStamp()

      Description copied from interface: `TimeStampedMetric`
      Gets the update time stamp.
      Specified by:
        `getUpdateTimeStamp` in interface `TimeStampedMetric`
      Returns:
        update time stamp

    - #### reset

          public void reset()

      Prepares the ratio gauge for use in a new time period by saving the most recent update time stamp as the previous time stamp. The value is not changed.
      Specified by:
        `reset` in interface `TimeStampedMetric`

    - #### setDenominator

          public void setDenominator(double toSet)

      Sets the denominator of this `TimeStampedRatioGauge`.
      Parameters:
        `toSet` - the denominator for this object

    - #### setDescriptor

          public void setDescriptor(RatioGaugeDescriptor toSet)

      Sets the `RatioGaugeDescriptor` that specifies characteristics of this `TimeStampedRatioGauge`.
      Parameters:
        `toSet` - the `RatioGaugeDescriptor` for this object

    - #### setNumerator

          public void setNumerator(double toSet)

      Sets the numerator of this `TimeStampedRatioGauge`.
      Parameters:
        `toSet` - the numerator for this object

    - #### setPreviousTimeStamp

          public void setPreviousTimeStamp(long time)

      Description copied from interface: `TimeStampedMetric`
      Sets the previous time stamp.
      Specified by:
        `setPreviousTimeStamp` in interface `TimeStampedMetric`
      Parameters:
        `time` - previous time stamp

    - #### setUid

          public void setUid(String toSet)

      Description copied from interface: `TimeStampedMetric`
      Sets the UID of this object.
      Specified by:
        `setUid` in interface `TimeStampedMetric`
      Parameters:
        `toSet` - new UID for this object

    - #### setUpdateTimeStamp

          public void setUpdateTimeStamp(long time)

      Description copied from interface: `TimeStampedMetric`
      Sets the update time stamp.
      Specified by:
        `setUpdateTimeStamp` in interface `TimeStampedMetric`
      Parameters:
        `time` - update time stamp

    - #### toDebugString

          public String toDebugString()

      Gets a detailed representation of this object to facilitate debugging.
      Returns:
        debug representation of object

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### update

          public void update(double numerator,
                    double denominator)

      Sets the numerator and denominator of this `TimeStampedRatioGauge`.
      Parameters:
        `numerator` - the numerator for this object
        `denominator` - the denominator for this object

    - #### updateDenominator

          public void updateDenominator(double toSet)

      Sets the denominator of this `TimeStampedRatioGauge`.
      Parameters:
        `toSet` - the denominator for this object

    - #### updateNumerator

          public void updateNumerator(double toSet)

      Sets the numerator of this `TimeStampedRatioGauge`.
      Parameters:
        `toSet` - the numerator for this object

    - #### updateTimeStamp

          public void updateTimeStamp()

      Description copied from interface: `TimeStampedMetric`
      Convenience method that sets the update time stamp to the current time.
      Specified by:
        `updateTimeStamp` in interface `TimeStampedMetric`

Copyright © 2014. All Rights Reserved.