Class Snapshot

java.lang.Object
com.codahale.metrics.Snapshot

public class Snapshot extends Object
A statistical snapshot of a Snapshot.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Charset
     
    private final long[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Snapshot(long[] values)
    Create a new Snapshot with the given values.
    Create a new Snapshot with the given values.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes the values of the snapshot to the given stream.
    double
    Returns the value at the 75th percentile in the distribution.
    double
    Returns the value at the 95th percentile in the distribution.
    double
    Returns the value at the 98th percentile in the distribution.
    double
    Returns the value at the 99.9th percentile in the distribution.
    double
    Returns the value at the 99th percentile in the distribution.
    long
    Returns the highest value in the snapshot.
    double
    Returns the arithmetic mean of the values in the snapshot.
    double
    Returns the median value in the distribution.
    long
    Returns the lowest value in the snapshot.
    double
    Returns the standard deviation of the values in the snapshot.
    double
    getValue(double quantile)
    Returns the value at the given quantile.
    long[]
    Returns the entire set of values in the snapshot.
    int
    Returns the number of values in the snapshot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UTF_8

      private static final Charset UTF_8
    • values

      private final long[] values
  • Constructor Details

    • Snapshot

      public Snapshot(Collection<Long> values)
      Create a new Snapshot with the given values.
      Parameters:
      values - an unordered set of values in the reservoir
    • Snapshot

      public Snapshot(long[] values)
      Create a new Snapshot with the given values.
      Parameters:
      values - an unordered set of values in the reservoir
  • Method Details

    • getValue

      public double getValue(double quantile)
      Returns the value at the given quantile.
      Parameters:
      quantile - a given quantile, in [0..1]
      Returns:
      the value in the distribution at quantile
    • size

      public int size()
      Returns the number of values in the snapshot.
      Returns:
      the number of values
    • getMedian

      public double getMedian()
      Returns the median value in the distribution.
      Returns:
      the median value
    • get75thPercentile

      public double get75thPercentile()
      Returns the value at the 75th percentile in the distribution.
      Returns:
      the value at the 75th percentile
    • get95thPercentile

      public double get95thPercentile()
      Returns the value at the 95th percentile in the distribution.
      Returns:
      the value at the 95th percentile
    • get98thPercentile

      public double get98thPercentile()
      Returns the value at the 98th percentile in the distribution.
      Returns:
      the value at the 98th percentile
    • get99thPercentile

      public double get99thPercentile()
      Returns the value at the 99th percentile in the distribution.
      Returns:
      the value at the 99th percentile
    • get999thPercentile

      public double get999thPercentile()
      Returns the value at the 99.9th percentile in the distribution.
      Returns:
      the value at the 99.9th percentile
    • getValues

      public long[] getValues()
      Returns the entire set of values in the snapshot.
      Returns:
      the entire set of values
    • getMax

      public long getMax()
      Returns the highest value in the snapshot.
      Returns:
      the highest value
    • getMin

      public long getMin()
      Returns the lowest value in the snapshot.
      Returns:
      the lowest value
    • getMean

      public double getMean()
      Returns the arithmetic mean of the values in the snapshot.
      Returns:
      the arithmetic mean
    • getStdDev

      public double getStdDev()
      Returns the standard deviation of the values in the snapshot.
      Returns:
      the standard value
    • dump

      public void dump(OutputStream output)
      Writes the values of the snapshot to the given stream.
      Parameters:
      output - an output stream