com.h3c.sdn.metric

## Class TimeStampedHistogram

- java.lang.Object
- - com.codahale.metrics.Histogram
  - - com.h3c.sdn.metric.TimeStampedHistogram

- All Implemented Interfaces:
    com.codahale.metrics.Counting, com.codahale.metrics.Metric, com.codahale.metrics.Sampling, TimeStampedMetric

      public class TimeStampedHistogram
      extends com.codahale.metrics.Histogram
      implements TimeStampedMetric

  Extension of Coda Hale `Histogram` class that provides an association of sliding time window `Histogram` values with time stamps.

- - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `HistogramDataPoint` | `extractDataPoint()` Extract a `HistogramDataPoint` from this object.
    `double` | `get75thPercentile()` Gets the value at the 75th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
    `double` | `get95thPercentile()` Gets the value at the 95th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
    `double` | `get98thPercentile()` Gets the value at the 98th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
    `double` | `get99thPercentile()` Gets the value at the 99th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
    `long` | `getCount()`
    `HistogramDescriptor` | `getDescriptor()` Gets the `MetricDescriptor` that describes this `TimeStampedMetric` object.
    `long` | `getMaximum()` Gets the maximum of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `double` | `getMean()` Gets the mean of the values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `double` | `getMedian()` Gets the median of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `long` | `getMinimum()` Gets the minimum of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `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.
    `long` | `getPreviousTimeStamp()` Gets the previous time stamp.
    `int` | `getSlidingWindowMinutes()` Gets the number of minutes spanned by the sliding time window of this `TimeStampedHistogram`.
    `double` | `getStandardDeviation()` Gets the standard deviation of the values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `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.
    `long[]` | `getValues()` Gets the actual values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
    `void` | `reset()` Prepares the histogram for use in a new time period.
    `void` | `setDescriptor(HistogramDescriptor toSet)` Sets the `HistogramDescriptor` that specifies characteristics of this `TimeStampedHistogram`.
    `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(int toAdd)`
    `void` | `update(long toAdd)`
    `void` | `updateTimeStamp()` Convenience method that sets the update time stamp to the current time.

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

      `getSnapshot`

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

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

- - ### Constructor Detail

    - #### TimeStampedHistogram

          public TimeStampedHistogram(MetricRegistry registry,
                              HistogramDescriptor descriptor)

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

    - #### TimeStampedHistogram

          public TimeStampedHistogram(MetricRegistry registry,
                              HistogramDescriptor descriptor,
                              String uid)

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

  - ### Method Detail

    - #### extractDataPoint

          public HistogramDataPoint extractDataPoint()

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

    - #### get75thPercentile

          public double get75thPercentile()

      Gets the value at the 75th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
      Returns:
        value at 75th percentile

    - #### get95thPercentile

          public double get95thPercentile()

      Gets the value at the 95th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
      Returns:
        value at 95th percentile

    - #### get98thPercentile

          public double get98thPercentile()

      Gets the value at the 98th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
      Returns:
        value at 98th percentile

    - #### get99thPercentile

          public double get99thPercentile()

      Gets the value at the 99th percentile of all values currently encompassed within the the sliding time window of this `TimeStampedHistogram`.
      Returns:
        value at 99th percentile

    - #### getCount

          public long getCount()

      Specified by:
        `getCount` in interface `com.codahale.metrics.Counting`
      Overrides:
        `getCount` in class `com.codahale.metrics.Histogram`

    - #### getDescriptor

          public HistogramDescriptor 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`

    - #### getMaximum

          public long getMaximum()

      Gets the maximum of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        maximum of histogram values

    - #### getMedian

          public double getMedian()

      Gets the median of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        median value (value at 50th percentile)

    - #### getMean

          public double getMean()

      Gets the mean of the values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        mean of histogram values

    - #### getMinimum

          public long getMinimum()

      Gets the minimum of all values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        minimum of histogram values

    - #### 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

    - #### getPreviousTimeStamp

          public long getPreviousTimeStamp()

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

    - #### getSlidingWindowMinutes

          public int getSlidingWindowMinutes()

      Gets the number of minutes spanned by the sliding time window of this `TimeStampedHistogram`.
      Returns:
        minutes in sliding window

    - #### getStandardDeviation

          public double getStandardDeviation()

      Gets the standard deviation of the values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        standard deviation of histogram values

    - #### 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

    - #### getValues

          public long[] getValues()

      Gets the actual values currently encompassed within the sliding time window of this `TimeStampedHistogram`.
      Returns:
        histogram values

    - #### reset

          public void reset()

      Prepares the histogram for use in a new time period. There is no way to clear the histogram, so just reset the span of time it will cover when it is next analyzed as starting at the current time. Set both the update and previous time stamps to the current time.
      Specified by:
        `reset` in interface `TimeStampedMetric`

    - #### setDescriptor

          public void setDescriptor(HistogramDescriptor toSet)

      Sets the `HistogramDescriptor` that specifies characteristics of this `TimeStampedHistogram`.
      Parameters:
        `toSet` - the `HistogramDescriptor` 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(int toAdd)

      Overrides:
        `update` in class `com.codahale.metrics.Histogram`

    - #### update

          public void update(long toAdd)

      Overrides:
        `update` in class `com.codahale.metrics.Histogram`

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