Additional top-level class in compilation unit: AbstractHistogramBase.
AbstractHistogram supports the recording and analyzing sampled data value counts across a configurable integer value range with configurable value precision within the range. Value precision is expressed as the number of significant 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.
For example, a Histogram could be configured to track the counts of observed integer values between 0 and 3,600,000,000 while maintaining a value precision of 3 significant digits across that range. Value quantization within the range will thus be no larger than 1/1,000th (or 0.1%) of any value. This example Histogram could be used to track and analyze the counts of observed response times ranging between 1 microsecond and 1 hour in magnitude, while maintaining a value resolution of 1 microsecond up to 1 millisecond, a resolution of 1 millisecond (or better) up to one second, and a resolution of 1 second (or better) up to 1,000 seconds. At it's maximum tracked value (1 hour), it would still maintain a resolution of 3.6 seconds (or better).
See package description for org. for details.
| Modifier and Type | Class and Description |
|---|---|
| public class | AbstractHistogram.AllValues
An |
| public class | AbstractHistogram.LinearBucketValues
An |
| public class | AbstractHistogram.LogarithmicBucketValues
An |
| public class | AbstractHistogram.Percentiles
An |
| public class | AbstractHistogram.RecordedValues
An |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final Class | |
| private static final int | |
| private static final int | |
| pack-priv int | leadingZeroCountBase
Number of leading zeros in the largest value that can fit in bucket 0. |
| pack-priv volatile long | |
| private static final AtomicLongFieldUpdater | |
| pack-priv volatile long | |
| private static final AtomicLongFieldUpdater | |
| private static final long | |
| pack-priv int | |
| pack-priv int | |
| pack-priv long | subBucketMask
Biggest value that can fit in bucket 0 |
| pack-priv int | unitMagnitude
Largest k such that 2^k <= lowestDiscernibleValue |
| pack-priv long | unitMagnitudeMask
Lowest unitMagnitude bits are set |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| protected | AbstractHistogram(final int
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 an auto-resizing histogram with a lowest discernible value of 1 and an auto-adjusting highestTrackableValue. |
| protected | AbstractHistogram(final long
The lowest value that can be discerned (distinguished from 0) by the histogram.
Must be a positive integer that is >= 1. May be internally rounded
down to nearest power of 2. lowestDiscernibleValue, final long The highest value to be tracked by the histogram. Must be a positive
integer that is >= (2 * lowestDiscernibleValue). highestTrackableValue, final int 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 histogram given the Lowest and Highest values to be tracked and a number of significant decimal digits. |
| protected | AbstractHistogram(final AbstractHistogram
The source histogram to duplicate source)Construct a histogram with the same range settings as a given source histogram, duplicating the source's start/end timestamps (but NOT it's contents) |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract int | |
| public void | add(final AbstractHistogram
The other histogram. otherHistogram)Add the contents of another histogram to this one. |
| pack-priv abstract void | |
| pack-priv abstract void | |
| public void | addWhileCorrectingForCoordinatedOmission(final AbstractHistogram
The other histogram. highestTrackableValue and largestValueWithSingleUnitResolution must match. otherHistogram, final long 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 AbstractHistogram. | Returns: Anjava.<HistogramIterationValue>
through the histogram using
a AllValuesIteratorProvide a means of iterating through all histogram values using the finest granularity steps supported by the underlying representation. |
| pack-priv abstract void | |
| public abstract AbstractHistogram | Returns: A distinct copy of this histogram.Create a copy of this histogram, complete with data and everything. |
| public abstract AbstractHistogram | 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 AbstractHistogram
the histogram to copy into targetHistogram)Copy this histogram into the target histogram, overwriting it's contents. |
| public void | copyIntoCorrectedForCoordinatedOmission(final AbstractHistogram
the histogram to copy into targetHistogram, final long 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. |
| pack-priv int | |
| private int | |
| pack-priv static <T extends AbstractHistogram> T | decodeFromByteBuffer(final ByteBuffer buffer, final Class<T> histogramClass, final long minBarForHighestTrackableValue)
|
| private static <T extends AbstractHistogram> T | decodeFromByteBuffer(final ByteBuffer buffer, final Class<T> histogramClass, final long minBarForHighestTrackableValue, final Inflater decompressor)
|
| pack-priv static <T extends AbstractHistogram> T | decodeFromCompressedByteBuffer(final ByteBuffer buffer, final Class<T> histogramClass, final long minBarForHighestTrackableValue)
|
| pack-priv final int | |
| 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. |
| pack-priv void | |
| pack-priv void | |
| pack-priv final void | establishSize(long newHighestTrackableValue)
The buckets (each of which has subBucketCount sub-buckets, here assumed to be 2048 as an example) overlap: The 0'th bucket covers from 0...2047 in multiples of 1, using all 2048 sub-buckets The 1'th bucket covers from 2048..4097 in multiples of 2, using only the top 1024 sub-buckets The 2'th bucket covers from 4096..8191 in multiple of 4, using only the top 1024 sub-buckets ... |
| pack-priv synchronized void | |
| private int | |
| pack-priv int | Returns: the lowest (and therefore highest precision) bucket index that can represent the value
|
| pack-priv int | |
| private int | |
| private static int | |
| pack-priv abstract long | |
| pack-priv abstract long | |
| 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 long | 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 long 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). |
| private int | |
| 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 | |
| pack-priv int | getLengthForNumberOfBuckets(final int numberOfBuckets)
If we have N such that subBucketCount * 2^N > max value, we need storage for N+1 buckets, each with enough slots to hold the top half of the subBucketCount (the lower half is covered by previous buckets), and the +1 being used for the lower half of the 0'th bucket. |
| public long | |
| public long | Returns: the Max value recorded in the histogramGet the highest recorded value level in the histogram. |
| public double | Returns: the Max value recorded in the histogramImplements 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 long | Returns: the lowest recorded non-zero value level in the histogramGet the lowest recorded non-zero value level in the histogram. |
| public long | 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. |
| pack-priv int | |
| pack-priv int | |
| pack-priv int | |
| pack-priv abstract 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 |
| pack-priv int | |
| public String | Returns: tag string [optionally] associated with this histogramImplements abstract org. |
| public abstract long | Returns: the total count of all recorded values in the histogramGet the total count of all recorded values in the histogram |
| public long | Returns: The largest value that (100% - percentile) [+/- 1 ulp] of the overall recorded value entries in the histogram are either larger than or equivalent to. Returns 0 if no recorded values exist.The percentile for which to return the associated value percentile)Get the value at a given percentile. |
| private static int | |
| private void | |
| public int | |
| public long | 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. |
| pack-priv abstract void | |
| pack-priv abstract void | |
| private void | init(final long lowestDiscernibleValue, final long highestTrackableValue, final int numberOfSignificantValueDigits, final double integerToDoubleValueConversionRatio, final int normalizingIndexOffset)
|
| public boolean | Returns: autoResize settingIndicate whether or not the histogram is set to auto-resize and auto-adjust it's highestTrackableValue |
| public AbstractHistogram. | Returns: Anjava.<HistogramIterationValue>
through the histogram using a
LinearIteratorThe size (in value units) of the linear buckets to use valueUnitsPerBucket)Provide a means of iterating through histogram values using linear steps. |
| public AbstractHistogram. | Returns: Anjava.<HistogramIterationValue>
through the histogram using
a LogarithmicIteratorThe 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 long | 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 long | 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 long | 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. |
| pack-priv void | |
| pack-priv int | Returns: The value `index - normalizingIndexOffset` modulo arrayLength (always nonnegative)
|
| pack-priv static int | |
| private int | |
| 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 AbstractHistogram. | Returns: Anjava.<HistogramIterationValue>
through the histogram using a
PercentileIteratorThe number of iteration steps per half-distance to 100%. percentileTicksPerHalfDistance)Provide a means of iterating through histogram values according to percentile levels. |
| private void | |
| pack-priv void | |
| public void | |
| private void | |
| public AbstractHistogram. | Returns: Anjava.<HistogramIterationValue>
through the histogram using
a RecordedValuesIteratorProvide a means of iterating through all recorded histogram values using the finest granularity steps supported by the underlying representation. |
| private String | |
| private void | |
| private void | recordSingleValueWithExpectedInterval(final long value, final long expectedIntervalBetweenValueSamples)
|
| public void | recordValue(final long
The value to be recorded value)Implements org. |
| public void | recordValue(final long
The value to record value, final long If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)
Deprecated
Record a value in the histogram. This deprecated method has identical behavior to
recordValueWithExpectedInterval(). It was renamed to avoid ambiguity.
|
| public void | recordValueWithCount(final long
The value to be recorded value, final long The number of occurrences of this value to record count)Implements org. |
| private void | recordValueWithCountAndExpectedInterval(final long value, final long count, final long expectedIntervalBetweenValueSamples)
|
| public void | recordValueWithExpectedInterval(final long
The value to record value, final long 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. |
| private void | |
| private void | |
| pack-priv abstract void | |
| public void | setAutoResize(boolean
autoResize setting autoResize)Control whether or not the histogram can auto-resize and auto-adjust it's highestTrackableValue |
| pack-priv abstract void | |
| pack-priv abstract 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. |
| pack-priv abstract void | |
| 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. |
| pack-priv abstract void | |
| private void | |
| pack-priv abstract void | shiftNormalizingIndexByOffset(int offsetToAdd, boolean lowestHalfBucketPopulated, double newIntegerToDoubleValueConversionRatio)
|
| public void | shiftValuesLeft(final int
The number of binary orders of magnitude to shift by numberOfBinaryOrdersOfMagnitude)Shift recorded values to the left (the equivalent of a << shift operation on all recorded values). |
| pack-priv void | shiftValuesLeft(final int numberOfBinaryOrdersOfMagnitude, final double newIntegerToDoubleValueConversionRatio)
|
| public void | shiftValuesRight(final int
The number of binary orders of magnitude to shift by numberOfBinaryOrdersOfMagnitude)Shift recorded values to the right (the equivalent of a >> shift operation on all recorded values). |
| pack-priv void | shiftValuesRight(final int numberOfBinaryOrdersOfMagnitude, final double newIntegerToDoubleValueConversionRatio)
|
| public long | Returns: The size of the range of values equivalent to the given value.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 AbstractHistogram
The other histogram. otherHistogram)Subtract the contents of another histogram from this one. |
| public boolean | Returns: autoResize settingIndicate whether or not the histogram is capable of supporting auto-resize functionality. |
| public String | |
| private void | updatedMaxValue(final long
new maxValue to set value)Set internally tracked maxValue to new value if new value is greater than current one. |
| pack-priv void | |
| private void | updateMinNonZeroValue(final long
new minNonZeroValue to set value)Set internally tracked minNonZeroValue to new value if new value is smaller than current one. |
| private long | |
| pack-priv final long | |
| public boolean | Returns: True if values are equivalent with the histogram's resolution.first value to compare value1, final long second value to compare value2)Determine if two values are equivalent with the histogram's resolution. |
| private void |