It is important to note that DoubleHistogram is not thread-safe, and does not support safe concurrent
recording by multiple threads. If concurrent operation is required, consider usings
ConcurrentDoubleHistogram, SynchronizedDoubleHistogram,
or (recommended) DoubleRecorder or SingleWriterDoubleRecorder which are intended for this purpose.
DoubleHistogram supports the recording and analyzing sampled data value counts across a
configurable dynamic range of floating point (double) values, with configurable value precision within the range.
Dynamic range is expressed as a ratio between the highest and lowest non-zero values trackable within the histogram
at any given time. Value precision is expressed as the number of significant [decimal] digits in the value recording,
and provides control over value quantization behavior across the value range and the subsequent value resolution at
any given level.
Auto-ranging: Unlike integer value based histograms, the specific value range tracked by a DoubleHistogram is not specified upfront. Only the dynamic range of values that the histogram can cover is
(optionally) specified. E.g. When a DoubleHistogram is created to track a dynamic range of
3600000000000 (enough to track values from a nanosecond to an hour), values could be recorded into into it in any
consistent unit of time as long as the ratio between the highest and lowest non-zero values stays within the
specified dynamic range, so recording in units of nanoseconds (1.0 thru 3600000000000.0), milliseconds (0.000001
thru 3600000.0) seconds (0.000000001 thru 3600.0), hours (1/3.6E12 thru 1.0) will all work just as well.
Auto-resizing: When constructed with no specified dynamic range (or when auto-resize is turned on with DoubleHistogram#setAutoResize) a DoubleHistogram will auto-resize its dynamic range to
include recorded values as they are encountered. Note that recording calls that cause auto-resizing may take
longer to execute, as resizing incurs allocation and copying of internal data structures.
Attempts to record non-zero values that range outside of the specified dynamic range (or exceed the limits of
of dynamic range when auto-resizing) may results in ArrayIndexOutOfBoundsException exceptions, either
due to overflow or underflow conditions. These exceptions will only be thrown if recording the value would have
resulted in discarding or losing the required value precision of values already recorded in the histogram.
See package description for org. for details.
| Modifier and Type | Class and Description |
|---|---|
| public class | DoubleHistogram.AllValues
An |
| public class | DoubleHistogram.LinearBucketValues
An |
| public class | DoubleHistogram.LogarithmicBucketValues
An |
| public class | DoubleHistogram.Percentiles
An |
| public class | DoubleHistogram.RecordedValues
An |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private long | |
| private static final Class | |
| private volatile double | |
| private volatile double | |
| private static final int | |
| private static final int | |
| private static final double | |
| pack-priv AbstractHistogram | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | DoubleHistogram(final int
Specifies the precision to use. This is the number of significant
decimal digits to which the histogram will maintain value resolution
and separation. Must be a non-negative integer between 0 and 5. numberOfSignificantValueDigits)Construct a new auto-resizing DoubleHistogram using a precision stated as a number of significant decimal digits. |
| public | DoubleHistogram(final int
Specifies the precision to use. This is the number of significant
decimal digits to which the histogram will maintain value resolution
and separation. Must be a non-negative integer between 0 and 5. numberOfSignificantValueDigits, final Class<? extends AbstractHistogram> The class to use for internal counts tracking internalCountsHistogramClass)Construct a new auto-resizing DoubleHistogram using a precision stated as a number of significant decimal digits. |
| public | DoubleHistogram(final long
specifies the dynamic range to use highestToLowestValueRatio, final int Specifies the precision to use. This is the number of significant
decimal digits to which the histogram will maintain value resolution
and separation. Must be a non-negative integer between 0 and 5. numberOfSignificantValueDigits)Construct a new DoubleHistogram with the specified dynamic range (provided in
|
| protected | DoubleHistogram(final long
specifies the dynamic range to use. highestToLowestValueRatio, final int Specifies the precision to use. This is the number of significant
decimal digits to which the histogram will maintain value resolution
and separation. Must be a non-negative integer between 0 and 5. numberOfSignificantValueDigits, final Class<? extends AbstractHistogram> The class to use for internal counts tracking internalCountsHistogramClass)Construct a new DoubleHistogram with the specified dynamic range (provided in
|
| pack-priv | DoubleHistogram(final long highestToLowestValueRatio, final int numberOfSignificantValueDigits, final Class<? extends AbstractHistogram> internalCountsHistogramClass, AbstractHistogram internalCountsHistogram)
|
| private | DoubleHistogram(final long highestToLowestValueRatio, final int numberOfSignificantValueDigits, final Class<? extends AbstractHistogram> internalCountsHistogramClass, AbstractHistogram internalCountsHistogram, boolean mimicInternalModel)
|
| public | DoubleHistogram(final DoubleHistogram
The source histogram to duplicate source)Construct a |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(final DoubleHistogram
The other histogram. fromHistogram)Add the contents of another histogram to this one. |
| public void | addWhileCorrectingForCoordinatedOmission(final DoubleHistogram
Other histogram. highestToLowestValueRatio and numberOfSignificantValueDigits must match. fromHistogram, final double If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)Add the contents of another histogram to this one, while correcting the incoming data for coordinated omission. |
| public DoubleHistogram. | Returns: Anjava.<DoubleHistogramIterationValue>
through the histogram using a DoubleAllValuesIteratorProvide a means of iterating through all histogram values using the finest granularity steps supported by the underlying representation. |
| private void | |
| private synchronized void | |
| pack-priv static <T extends DoubleHistogram> T | constructHistogramFromBuffer(int cookie, final ByteBuffer buffer, final Class<T> doubleHistogramClass, final Class<? extends AbstractHistogram> histogramClass, final long minBarForHighestToLowestValueRatio)
|
| public DoubleHistogram | Returns: A distinct copy of this histogram.Create a copy of this histogram, complete with data and everything. |
| public DoubleHistogram | Returns: a copy of this histogram, corrected for coordinated omission.If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)Get a copy of this histogram, corrected for coordinated omission. |
| public void | copyInto(final DoubleHistogram
the histogram to copy into targetHistogram)Copy this histogram into the target histogram, overwriting it's contents. |
| public void | copyIntoCorrectedForCoordinatedOmission(final DoubleHistogram
the histogram to copy into targetHistogram, final double If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)Copy this histogram, corrected for coordinated omission, into the target histogram, overwriting it's contents. |
| public static DoubleHistogram | Returns: The newly constructed DoubleHistogramThe buffer to decode from buffer, final long Force highestTrackableValue to be set at least this high minBarForHighestToLowestValueRatio)Construct a new DoubleHistogram by decoding it from a ByteBuffer. |
| public static DoubleHistogram | Returns: The newly constructed DoubleHistogramThe buffer to decode from buffer, final Class<? extends AbstractHistogram> The class to use for internal counts tracking internalCountsHistogramClass, long Force highestTrackableValue to be set at least this high minBarForHighestToLowestValueRatio)Construct a new DoubleHistogram by decoding it from a ByteBuffer, using a
specified AbstractHistogram subclass for tracking internal counts (e.g. |
| public static DoubleHistogram | Returns: The newly constructed DoubleHistogramThe buffer to decode from buffer, final long Force highestTrackableValue to be set at least this high minBarForHighestToLowestValueRatio)Hides org. |
| public static DoubleHistogram | Returns: The newly constructed DoubleHistogramThe buffer to decode from buffer, Class<? extends AbstractHistogram> The class to use for internal counts tracking internalCountsHistogramClass, long Force highestTrackableValue to be set at least this high minBarForHighestToLowestValueRatio)Construct a new DoubleHistogram by decoding it from a compressed form in a ByteBuffer, using a
specified AbstractHistogram subclass for tracking internal counts (e.g. |
| private long | deriveIntegerValueRange(final long externalHighestToLowestValueRatio, final int numberOfSignificantValueDigits)
|
| private long | |
| public synchronized int | Returns: The number of bytes written to the bufferThe buffer to encode into buffer)Encode this histogram into a ByteBuffer |
| public synchronized int | Returns: The number of bytes written to the bufferThe buffer to encode into targetBuffer, final int Compression level (for java.util.zip.Deflater). compressionLevel)Implements abstract org. |
| public int | Returns: The number of bytes written to the arrayThe buffer to encode into targetBuffer)Encode this histogram in compressed form into a byte array |
| public boolean | Returns: True if this histogram are equivalent with the other.the other histogram to compare to other)Overrides java. |
| private int | |
| private static int | |
| private static int | |
| public static DoubleHistogram | Returns: A DoubleHistogram decoded from the stringA string containing a base64 encoding of a compressed histogram base64CompressedHistogramString)Construct a new DoubleHistogram by decoding it from a String containing a base64 encoded compressed histogram representation. |
| public long | Returns: The total count of values recorded in the histogram within the value range that is >= lowestEquivalentValue(value) and <= highestEquivalentValue(value)The value for which to provide the recorded count value)Get the count of recorded values at a specific value (to within the histogram resolution at the value level). |
| public double | Returns: the total count of values recorded in the histogram within the value range that is >= lowestEquivalentValue(lowValue) and <= highestEquivalentValue(highValue)The lower value bound on the range for which
to provide the recorded count. Will be rounded down with
lowValue, final double lowestEquivalentValue.The higher value bound on the range for which to provide the recorded count.
Will be rounded up with highValue)highestEquivalentValue.Get the count of recorded values within a range of value levels (inclusive to within the histogram's resolution). |
| pack-priv double | Returns: current highest trackable value in the automatically determined rangeget the current highest trackable value in the automatically determined range (keep in mind that this can change because it is auto ranging) |
| pack-priv double | Returns: current lowest trackable value the automatically determined rangeget the current lowest (non zero) trackable value the automatically determined range (keep in mind that this can change because it is auto ranging) |
| pack-priv double | |
| public long | Returns: the end time stamp [optionally] stored with this histogramImplements abstract org. |
| public int | Returns: a (conservatively high) estimate of the Histogram's total footprint in bytesProvide a (conservatively high) estimate of the Histogram's total footprint in bytes |
| public long | Returns: the dynamic range of the histogram, expressed as the ratio between the highest trackable value and the lowest trackable non zero value at any given time.get the Dynamic range of the histogram: the configured ratio between the highest trackable value and the lowest trackable non zero value at any given time. |
| public double | Returns: the current conversion ratio from interval integer value representation to double units.Get the current conversion ratio from interval integer value representation to double units. |
| private long | |
| public double | Returns: the Max value recorded in the histogramGet the highest recorded value level in the histogram |
| public double | Returns: the highest recorded value level in the histogram as a doubleImplements abstract org. |
| public double | Returns: the mean value (in value units) of the histogram dataGet the computed mean value of all recorded values in the histogram |
| public double | Returns: the lowest recorded non-zero value level in the histogramGet the lowest recorded non-zero value level in the histogram |
| public double | Returns: the Min value recorded in the histogramGet the lowest recorded value level in the histogram |
| public int | Returns: the capacity needed to encode this histogram into a ByteBufferImplements abstract org. |
| private int | |
| public int | Returns: numberOfSignificantValueDigitsget the configured numberOfSignificantValueDigits |
| public double | Returns: The percentile of values recorded in the histogram that are smaller than or equivalent to the given value.The value for which to return the associated percentile value)Get the percentile at a given value. |
| public long | Returns: the start time stamp [optionally] stored with this histogramImplements abstract org. |
| public double | Returns: the standard deviation (in value units) of the histogram dataGet the computed standard deviation of all recorded values in the histogram |
| public String | Returns: tag string [optionally] associated with this histogramImplements abstract org. |
| public long | Returns: the total count of all recorded values in the histogramGet the total count of all recorded values in the histogram |
| public double | Returns: The value that the given percentage of the overall recorded value entries in the histogram are either smaller than or equivalent to. When the percentile is 0.0, returns the value that all value entries in the histogram are either larger than or equivalent to.The percentile for which to return the associated value percentile)Get the value at a given percentile. |
| private void | |
| public int | |
| public double | Returns: The highest value that is equivalent to the given value within the histogram's resolution.The given value value)Get the highest value that is equivalent to the given value within the histogram's resolution. |
| private void | init(final long configuredHighestToLowestValueRatio, final double lowestTrackableUnitValue, final AbstractHistogram integerValuesHistogram)
|
| public boolean | |
| pack-priv static boolean | |
| pack-priv static boolean | |
| pack-priv static boolean | |
| public DoubleHistogram. | Returns: Anjava.<DoubleHistogramIterationValue>
through the histogram using a
DoubleLinearIteratorThe size (in value units) of the linear buckets to use valueUnitsPerBucket)Provide a means of iterating through histogram values using linear steps. |
| public DoubleHistogram. | Returns: Anjava.<DoubleHistogramIterationValue>
through the histogram using
a DoubleLogarithmicIteratorThe size (in value units) of the first bucket in the iteration valueUnitsInFirstBucket, final double The multiplier by which bucket sizes will grow in each iteration step logBase)Provide a means of iterating through histogram values at logarithmically increasing levels. |
| public double | Returns: The lowest value that is equivalent to the given value within the histogram's resolution.The given value value)Get the lowest value that is equivalent to the given value within the histogram's resolution. |
| public double | Returns: The value lies in the middle (rounded up) of the range of values equivalent the given value.The given value value)Get a value that lies in the middle (rounded up) of the range of values equivalent the given value. |
| public double | Returns: The next value that is not equivalent to the given value within the histogram's resolution.The given value value)Get the next value that is not equivalent to the given value within the histogram's resolution. |
| public void | outputPercentileDistribution(final PrintStream
Stream into which the distribution will be output
printStream, final Double The scaling factor by which to divide histogram recorded values units in
output outputValueUnitScalingRatio)Produce textual representation of the value distribution of histogram data by percentile. |
| public void | outputPercentileDistribution(final PrintStream
Stream into which the distribution will be output
printStream, final int The number of reporting points per exponentially decreasing half-distance
percentileTicksPerHalfDistance, final Double The scaling factor by which to divide histogram recorded values units in
output outputValueUnitScalingRatio)Produce textual representation of the value distribution of histogram data by percentile. |
| public void | outputPercentileDistribution(final PrintStream
Stream into which the distribution will be output
printStream, final int The number of reporting points per exponentially decreasing half-distance
percentileTicksPerHalfDistance, final Double The scaling factor by which to divide histogram recorded values units in
output outputValueUnitScalingRatio, final boolean Output in CSV format if true. Otherwise use plain text form. useCsvFormat)Produce textual representation of the value distribution of histogram data by percentile. |
| public DoubleHistogram. | Returns: Anjava.<DoubleHistogramIterationValue>
through the histogram using a
DoublePercentileIteratorThe number of iteration steps per half-distance to 100%. percentileTicksPerHalfDistance)Provide a means of iterating through histogram values according to percentile levels. |
| private void | |
| private void | |
| public DoubleHistogram. | Returns: Anjava.<DoubleHistogramIterationValue>
through the histogram using
a DoubleRecordedValuesIteratorProvide a means of iterating through all recorded histogram values using the finest granularity steps supported by the underlying representation. |
| private void | |
| public void | recordValue(final double
The value to be recorded value)Implements org. |
| public void | recordValueWithCount(final double
The value to be recorded value, final long The number of occurrences of this value to record count)Implements org. |
| private void | recordValueWithCountAndExpectedInterval(final double value, final long count, final double expectedIntervalBetweenValueSamples)
|
| public void | recordValueWithExpectedInterval(final double
The value to record value, final double If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)Implements org. |
| public void | reset()
Implements org. |
| public void | |
| public void | setEndTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch. timeStampMsec)Implements abstract org. |
| public void | setStartTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch. timeStampMsec)Implements abstract org. |
| public void | setTag(String
the tag string to assciate with this histogram tag)Implements abstract org. |
| private void | |
| private void | |
| private void | |
| public double | Returns: The lowest value that is equivalent to the given value within the histogram's resolution.The given value value)Get the size (in value units) of the range of values that are equivalent to the given value within the histogram's resolution. |
| public void | subtract(final DoubleHistogram
The other histogram. otherHistogram)Subtract the contents of another histogram from this one. |
| public boolean | Returns: True if values are equivalent to within the histogram's resolution.first value to compare value1, final double second value to compare value2)Determine if two values are equivalent with the histogram's resolution. |
| private void |