public final class HdrHistogram extends Object
A wrapper on top of the HdrHistogram API. It handles writing to the histogram by delegating
to an internal ValueRecorder
implementation, and reading from the histogram by
efficiently implementing the retrieval of up-to-date histogram data (the exact implementation of
these varies depending on the HdrHistogram.ThreadSafetyMode
with which the provider is initialized).
Note that all APIs expect a timestamp which is used by the histogram to discard decaying data and determine when the snapshot from which the histogram metrics are calculated should be refreshed.
Modifier and Type | Class and Description |
---|---|
static class |
HdrHistogram.ThreadSafetyMode
Describes the desired thread safety guarantees of the internally maintained HdrHistogram
ValueRecorder implementation. |
Constructor and Description |
---|
HdrHistogram(HdrHistogram.ThreadSafetyMode mode,
long highestTrackableValue,
int numberOfSignificantValueDigits) |
Modifier and Type | Method and Description |
---|---|
long |
count(long now) |
long |
max(long now) |
double |
mean(long now) |
double |
measurePercentile(long now,
double percentile)
Reads percentile data from the histogram.
|
long |
min(long now) |
void |
record(long value)
Writes to the histogram.
|
double |
stdDeviation(long now) |
public HdrHistogram(HdrHistogram.ThreadSafetyMode mode, long highestTrackableValue, int numberOfSignificantValueDigits)
public void record(long value)
ArrayIndexOutOfBoundsException
if the histogram's
highestTrackableValue is lower than the value being recorded.value
- The value to be recorded. Cannot be negative.public long count(long now)
now
- An externally provided timestamp expected to be in milliseconds.record(long)
has been called.public long max(long now)
now
- An externally provided timestamp expected to be in milliseconds.public double mean(long now)
now
- An externally provided timestamp expected to be in milliseconds.public long min(long now)
now
- An externally provided timestamp expected to be in milliseconds.public double stdDeviation(long now)
now
- An externally provided timestamp expected to be in milliseconds.public double measurePercentile(long now, double percentile)
now
- An externally provided timestamp expected to be in milliseconds.percentile
- The percentile for which a value is going to be retrieved. Expected to be
between 0.0 and 100.0.