It is important to note that concurrent recording, auto-sizing, and value shifting are the only thread-safe
behaviors provided by ConcurrentHistogram, and that it is not otherwise synchronized. Specifically, ConcurrentHistogram provides no implicit synchronization that would prevent the contents of the histogram
from changing during queries, iterations, copies, or addition operations on the histogram. Callers wishing to make
potentially concurrent, multi-threaded updates that would safely work in the presence of queries, copies, or
additions of histogram objects should either take care to externally synchronize and/or order their access,
use the SynchronizedHistogram variant, or (recommended) use Recorder or
SingleWriterRecorder which are intended for this purpose.
Auto-resizing: When constructed with no specified value range range (or when auto-resize is turned on with Histogram#setAutoResize) a Histogram 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.
See package description for org. for details.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile ConcurrentHistogram. | |
| pack-priv volatile ConcurrentHistogram. | |
| pack-priv volatile long | |
| pack-priv static final AtomicLongFieldUpdater | |
| pack-priv transient WriterReaderPhaser |
| Access | Constructor and Description |
|---|---|
| public | ConcurrentHistogram(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 an auto-resizing ConcurrentHistogram with a lowest discernible value of 1 and an auto-adjusting highestTrackableValue. |
| public | ConcurrentHistogram(final long
The highest value to be tracked by the histogram. Must be a positive
integer that is >= 2. highestTrackableValue, 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 ConcurrentHistogram given the Highest value to be tracked and a number of significant decimal digits. |
| public | ConcurrentHistogram(final long
The lowest value that can be tracked (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 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 ConcurrentHistogram given the Lowest and Highest values to be tracked and a number of significant decimal digits. |
| public | ConcurrentHistogram(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) |
| pack-priv | |
| pack-priv | ConcurrentHistogram(final long lowestDiscernibleValue, final long highestTrackableValue, final int numberOfSignificantValueDigits, boolean allocateCountsArray)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv int | |
| pack-priv void | addToCountAtIndex(final int index, final long value)
Overrides org. |
| pack-priv void | |
| pack-priv ConcurrentHistogram. | |
| pack-priv void | |
| public ConcurrentHistogram | copy()
Overrides org. |
| public ConcurrentHistogram | copyCorrectedForCoordinatedOmission(final long
If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples expectedIntervalBetweenValueSamples)Overrides org. |
| pack-priv void | copyInactiveCountsContentsOnResize(ConcurrentHistogram.
|
| public static ConcurrentHistogram | Returns: The newly constructed histogramThe buffer to decode from buffer, final long Force highestTrackableValue to be set at least this high minBarForHighestTrackableValue)
Construct a new histogram by decoding it from a ByteBuffer.
|
| public static ConcurrentHistogram | Returns: The newly constructed histogramThe buffer to decode from buffer, final long Force highestTrackableValue to be set at least this high minBarForHighestTrackableValue)Hides org. |
| pack-priv synchronized void | fillBufferFromCountsArray(final ByteBuffer buffer)
Overrides org. |
| public static ConcurrentHistogram | Returns: A ConcurrentHistogram decoded from the stringA string containing a base64 encoding of a compressed histogram base64CompressedHistogramString)
Construct a new ConcurrentHistogram by decoding it from a String containing a base64 encoded
compressed histogram representation.
|
| pack-priv long | |
| pack-priv long | getCountAtNormalizedIndex(final int index)
Overrides org. |
| pack-priv int | |
| public long | getTotalCount()
Overrides org. |
| pack-priv void | |
| pack-priv void | |
| private void | |
| pack-priv void | recordConvertedDoubleValue(final double value)
Overrides org. |
| public void | recordConvertedDoubleValueWithCount(final double value, final long count)
Overrides org. |
| pack-priv void | |
| public void | setAutoResize(final boolean
autoResize setting autoResize)
Control whether or not the histogram can auto-resize and auto-adjust it's
highestTrackableValue
|
| pack-priv void | setCountAtIndex(final int index, final long value)
Overrides org. |
| pack-priv void | setCountAtNormalizedIndex(final int index, final long value)
Overrides org. |
| pack-priv void | setIntegerToDoubleValueConversionRatio(final double integerToDoubleValueConversionRatio)
Overrides org. |
| pack-priv void | setNormalizingIndexOffset(final int normalizingIndexOffset)
Overrides org. |
| private void | setNormalizingIndexOffset(final int newNormalizingIndexOffset, final int shiftedAmount, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio)
|
| private void | setNormalizingIndexOffsetForInactive(final int newNormalizingIndexOffset, final int shiftedAmount, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio)
|
| pack-priv void | |
| private void | |
| pack-priv void | shiftNormalizingIndexByOffset(final int offsetToAdd, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio)
Overrides org. |
| activeCounts | back to summary |
|---|---|
| pack-priv volatile ConcurrentHistogram. | |
| inactiveCounts | back to summary |
|---|---|
| pack-priv volatile ConcurrentHistogram. | |
| totalCount | back to summary |
|---|---|
| pack-priv volatile long totalCount | |
| totalCountUpdater | back to summary |
|---|---|
| pack-priv static final AtomicLongFieldUpdater<ConcurrentHistogram> totalCountUpdater | |
| wrp | back to summary |
|---|---|
| pack-priv transient WriterReaderPhaser wrp | |
| ConcurrentHistogram | back to summary |
|---|---|
| public ConcurrentHistogram(final int numberOfSignificantValueDigits) Construct an auto-resizing ConcurrentHistogram with a lowest discernible value of 1 and an auto-adjusting highestTrackableValue. Can auto-resize up to track values up to (Long.MAX_VALUE / 2).
| |
| ConcurrentHistogram | back to summary |
|---|---|
| public ConcurrentHistogram(final long highestTrackableValue, final int numberOfSignificantValueDigits) Construct a ConcurrentHistogram given the Highest value to be tracked and a number of significant decimal digits. The histogram will be constructed to implicitly track (distinguish from 0) values as low as 1.
| |
| ConcurrentHistogram | back to summary |
|---|---|
| public ConcurrentHistogram(final long lowestDiscernibleValue, final long highestTrackableValue, final int numberOfSignificantValueDigits) Construct a ConcurrentHistogram given the Lowest and Highest values to be tracked and a number of significant decimal digits. Providing a lowestDiscernibleValue is useful is situations where the units used for the histogram's values are much smaller that the minimal accuracy required. E.g. when tracking time values stated in nanosecond units, where the minimal accuracy required is a microsecond, the proper value for lowestDiscernibleValue would be 1000.
| |
| ConcurrentHistogram | back to summary |
|---|---|
| public ConcurrentHistogram(final AbstractHistogram 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)
| |
| ConcurrentHistogram | back to summary |
|---|---|
| pack-priv ConcurrentHistogram(final AbstractHistogram source, boolean allocateCountsArray) | |
| ConcurrentHistogram | back to summary |
|---|---|
| pack-priv ConcurrentHistogram(final long lowestDiscernibleValue, final long highestTrackableValue, final int numberOfSignificantValueDigits, boolean allocateCountsArray) | |
| _getEstimatedFootprintInBytes | back to summary |
|---|---|
| pack-priv int _getEstimatedFootprintInBytes() Overrides org.
| |
| addToCountAtIndex | back to summary |
|---|---|
| pack-priv void addToCountAtIndex(final int index, final long value) Overrides org.
| |
| addToTotalCount | back to summary |
|---|---|
| pack-priv void addToTotalCount(final long value) Overrides org.
| |
| allocateArray | back to summary |
|---|---|
| pack-priv ConcurrentHistogram. | |
| clearCounts | back to summary |
|---|---|
| pack-priv void clearCounts() Overrides org.
| |
| copy | back to summary |
|---|---|
| public ConcurrentHistogram copy() Overrides org. Doc from org. Create a copy of this histogram, complete with data and everything.
| |
| copyCorrectedForCoordinatedOmission | back to summary |
|---|---|
| public ConcurrentHistogram copyCorrectedForCoordinatedOmission(final long expectedIntervalBetweenValueSamples) Overrides org. Doc from org. Get a copy of this histogram, corrected for coordinated omission. To compensate for the loss of sampled values when a recorded value is larger than the expected interval between value samples, the new histogram will include an auto-generated additional series of decreasingly-smaller (down to the expectedIntervalBetweenValueSamples) value records for each count found in the current histogram that is larger than the expectedIntervalBetweenValueSamples. Note This is a post-correction method, as opposed to the at-recording correction method provided
by See notes in the description of the Histogram calls for an illustration of why this corrective behavior is important.
| |
| copyInactiveCountsContentsOnResize | back to summary |
|---|---|
| pack-priv void copyInactiveCountsContentsOnResize(ConcurrentHistogram. | |
| decodeFromByteBuffer | back to summary |
|---|---|
| public static ConcurrentHistogram decodeFromByteBuffer(final ByteBuffer buffer, final long minBarForHighestTrackableValue) Hides org. Construct a new histogram by decoding it from a ByteBuffer.
| |
| decodeFromCompressedByteBuffer | back to summary |
|---|---|
| public static ConcurrentHistogram decodeFromCompressedByteBuffer(final ByteBuffer buffer, final long minBarForHighestTrackableValue) throws DataFormatException Hides org. Construct a new histogram by decoding it from a compressed form in a ByteBuffer.
| |
| fillBufferFromCountsArray | back to summary |
|---|---|
| pack-priv synchronized void fillBufferFromCountsArray(final ByteBuffer buffer) Overrides org.
| |
| fromString | back to summary |
|---|---|
| public static ConcurrentHistogram fromString(final String base64CompressedHistogramString) throws DataFormatException Hides org. Construct a new ConcurrentHistogram by decoding it from a String containing a base64 encoded compressed histogram representation.
| |
| getCountAtIndex | back to summary |
|---|---|
| pack-priv long getCountAtIndex(final int index) Overrides org.
| |
| getCountAtNormalizedIndex | back to summary |
|---|---|
| pack-priv long getCountAtNormalizedIndex(final int index) Overrides org.
| |
| getNormalizingIndexOffset | back to summary |
|---|---|
| pack-priv int getNormalizingIndexOffset() Overrides org.
| |
| getTotalCount | back to summary |
|---|---|
| public long getTotalCount() Overrides org. Doc from org. Get the total count of all recorded values in the histogram
| |
| incrementCountAtIndex | back to summary |
|---|---|
| pack-priv void incrementCountAtIndex(final int index) Overrides org.
| |
| incrementTotalCount | back to summary |
|---|---|
| pack-priv void incrementTotalCount() Overrides org.
| |
| readObject | back to summary |
|---|---|
| private void readObject(final ObjectInputStream o) throws IOException, ClassNotFoundException | |
| recordConvertedDoubleValue | back to summary |
|---|---|
| pack-priv void recordConvertedDoubleValue(final double value) Overrides org.
| |
| recordConvertedDoubleValueWithCount | back to summary |
|---|---|
| public void recordConvertedDoubleValueWithCount(final double value, final long count) throws ArrayIndexOutOfBoundsException Overrides org.
| |
| resize | back to summary |
|---|---|
| pack-priv void resize(final long newHighestTrackableValue) Overrides org.
| |
| setAutoResize | back to summary |
|---|---|
| public void setAutoResize(final boolean autoResize) Overrides org. Doc from org. Control whether or not the histogram can auto-resize and auto-adjust it's highestTrackableValue
| |
| setCountAtIndex | back to summary |
|---|---|
| pack-priv void setCountAtIndex(final int index, final long value) Overrides org.
| |
| setCountAtNormalizedIndex | back to summary |
|---|---|
| pack-priv void setCountAtNormalizedIndex(final int index, final long value) Overrides org.
| |
| setIntegerToDoubleValueConversionRatio | back to summary |
|---|---|
| pack-priv void setIntegerToDoubleValueConversionRatio(final double integerToDoubleValueConversionRatio) Overrides org.
| |
| setNormalizingIndexOffset | back to summary |
|---|---|
| pack-priv void setNormalizingIndexOffset(final int normalizingIndexOffset) Overrides org.
| |
| setNormalizingIndexOffset | back to summary |
|---|---|
| private void setNormalizingIndexOffset(final int newNormalizingIndexOffset, final int shiftedAmount, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio) | |
| setNormalizingIndexOffsetForInactive | back to summary |
|---|---|
| private void setNormalizingIndexOffsetForInactive(final int newNormalizingIndexOffset, final int shiftedAmount, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio) | |
| setTotalCount | back to summary |
|---|---|
| pack-priv void setTotalCount(final long totalCount) Overrides org.
| |
| shiftLowestInactiveHalfBucketContentsLeft | back to summary |
|---|---|
| private void shiftLowestInactiveHalfBucketContentsLeft(final int shiftAmount, final int preShiftZeroIndex) | |
| shiftNormalizingIndexByOffset | back to summary |
|---|---|
| pack-priv void shiftNormalizingIndexByOffset(final int offsetToAdd, final boolean lowestHalfBucketPopulated, final double newIntegerToDoubleValueConversionRatio) Overrides org.
| |
| Modifier and Type | Field and Description |
|---|---|
| private double | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | atomicAdd(int index, long valueToAdd)
Implements org. |
| public void | |
| public double | |
| public int | |
| public int | |
| public void | setDoubleToIntegerValueConversionRatio(double doubleToIntegerValueConversionRatio)
|
| public void | setNormalizingIndexOffset(int normalizingIndexOffset)
Implements org. |
| doubleToIntegerValueConversionRatio | back to summary |
|---|---|
| private double doubleToIntegerValueConversionRatio | |
| normalizingIndexOffset | back to summary |
|---|---|
| private int normalizingIndexOffset | |
| AtomicLongArrayWithNormalizingOffset | back to summary |
|---|---|
| pack-priv AtomicLongArrayWithNormalizingOffset(int length, int normalizingIndexOffset) | |
| atomicAdd | back to summary |
|---|---|
| public void atomicAdd(int index, long valueToAdd) Implements org.
| |
| atomicIncrement | back to summary |
|---|---|
| public void atomicIncrement(int index) Implements org.
| |
| getDoubleToIntegerValueConversionRatio | back to summary |
|---|---|
public double getDoubleToIntegerValueConversionRatio()
| |
| getEstimatedFootprintInBytes | back to summary |
|---|---|
| public int getEstimatedFootprintInBytes() Implements org.
| |
| getNormalizingIndexOffset | back to summary |
|---|---|
| public int getNormalizingIndexOffset() Implements org.
| |
| setDoubleToIntegerValueConversionRatio | back to summary |
|---|---|
public void setDoubleToIntegerValueConversionRatio(double doubleToIntegerValueConversionRatio)
| |
| setNormalizingIndexOffset | back to summary |
|---|---|
| public void setNormalizingIndexOffset(int normalizingIndexOffset) Implements org.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public long | |
| public double | |
| public int | |
| public int | |
| public void | |
| public int | |
| public void | |
| public void |
| atomicAdd | back to summary |
|---|---|
| public void atomicAdd(int index, long valueToAdd) | |
| atomicIncrement | back to summary |
|---|---|
| public void atomicIncrement(int index) | |
| get | back to summary |
|---|---|
| public long get(int index) | |
| getDoubleToIntegerValueConversionRatio | back to summary |
|---|---|
| public double getDoubleToIntegerValueConversionRatio() | |
| getEstimatedFootprintInBytes | back to summary |
|---|---|
| public int getEstimatedFootprintInBytes() | |
| getNormalizingIndexOffset | back to summary |
|---|---|
| public int getNormalizingIndexOffset() | |
| lazySet | back to summary |
|---|---|
| public void lazySet(int index, long newValue) | |
| length | back to summary |
|---|---|
| public int length() | |
| setDoubleToIntegerValueConversionRatio | back to summary |
|---|---|
| public void setDoubleToIntegerValueConversionRatio(double doubleToIntegerValueConversionRatio) | |
| setNormalizingIndexOffset | back to summary |
|---|---|
| public void setNormalizingIndexOffset(int normalizingIndexOffset) | |