Package com.codahale.metrics
Class Snapshot
- java.lang.Object
-
- com.codahale.metrics.Snapshot
-
public class Snapshot extends java.lang.Object
A statistical snapshot of aSnapshot
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump(java.io.OutputStream output)
Writes the values of the snapshot to the given stream.double
get75thPercentile()
Returns the value at the 75th percentile in the distribution.double
get95thPercentile()
Returns the value at the 95th percentile in the distribution.double
get98thPercentile()
Returns the value at the 98th percentile in the distribution.double
get999thPercentile()
Returns the value at the 99.9th percentile in the distribution.double
get99thPercentile()
Returns the value at the 99th percentile in the distribution.long
getMax()
Returns the highest value in the snapshot.double
getMean()
Returns the arithmetic mean of the values in the snapshot.double
getMedian()
Returns the median value in the distribution.long
getMin()
Returns the lowest value in the snapshot.double
getStdDev()
Returns the standard deviation of the values in the snapshot.double
getValue(double quantile)
Returns the value at the given quantile.long[]
getValues()
Returns the entire set of values in the snapshot.int
size()
Returns the number of values in the snapshot.
-
-
-
Constructor Detail
-
Snapshot
public Snapshot(java.util.Collection<java.lang.Long> values)
Create a newSnapshot
with the given values.- Parameters:
values
- an unordered set of values in the reservoir
-
Snapshot
public Snapshot(long[] values)
Create a newSnapshot
with the given values.- Parameters:
values
- an unordered set of values in the reservoir
-
-
Method Detail
-
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(java.io.OutputStream output)
Writes the values of the snapshot to the given stream.- Parameters:
output
- an output stream
-
-