Top Description Fields Constructors Methods
org.HdrHistogram

public Class SynchronizedHistogram

extends Histogram
Class Inheritance
Imports
java.io.IOException, .ObjectInputStream, .PrintStream, java.nio.ByteBuffer, java.util.zip.DataFormatException

An integer values High Dynamic Range (HDR) Histogram that is synchronized as a whole

A SynchronizedHistogram is a variant of Histogram that is synchronized as a whole, such that queries, copying, and addition operations are atomic with relation to modification on the SynchronizedHistogram, and such that external accessors (e.g. iterations on the histogram data) that synchronize on the SynchronizedHistogram instance can safely assume that no modifications to the histogram data occur within their synchronized block.

It is important to note that synchronization can result in blocking recoding calls. If non-blocking recoding operations are required, consider using ConcurrentHistogram, AtomicHistogram, or (recommended) Recorder or org.HdrHistogram.SingleWriterRecorder which were intended for concurrent operations.

See package description for org.HdrHistogram and org.HdrHistogram.Histogram for more details.

Field Summary

Inherited from org.HdrHistogram.Histogram:
countsnormalizingIndexOffsettotalCount

Constructor Summary

AccessConstructor and Description
public
SynchronizedHistogram(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 SynchronizedHistogram with a lowest discernible value of 1 and an auto-adjusting highestTrackableValue.

public
SynchronizedHistogram(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 SynchronizedHistogram given the Highest value to be tracked and a number of significant decimal digits.

public
SynchronizedHistogram(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 SynchronizedHistogram given the Lowest and Highest values to be tracked and a number of significant decimal digits.

public
SynchronizedHistogram(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)

Method Summary

Modifier and TypeMethod and Description
public void
add(final AbstractHistogram
The other histogram.
otherHistogram
)

Overrides org.HdrHistogram.AbstractHistogram.add.

Add the contents of another histogram to this one.
public void
addWhileCorrectingForCoordinatedOmission(final AbstractHistogram
The other histogram. highestTrackableValue and largestValueWithSingleUnitResolution must match.
fromHistogram
,
final long
If expectedIntervalBetweenValueSamples is larger than 0, add auto-generated value records as appropriate if value is larger than expectedIntervalBetweenValueSamples
expectedIntervalBetweenValueSamples
)

Overrides org.HdrHistogram.AbstractHistogram.addWhileCorrectingForCoordinatedOmission.

Add the contents of another histogram to this one, while correcting the incoming data for coordinated omission.
public synchronized AbstractHistogram.AllValues
allValues()

Overrides org.HdrHistogram.AbstractHistogram.allValues.

Provide a means of iterating through all histogram values using the finest granularity steps supported by the underlying representation.
public synchronized SynchronizedHistogram
copy()

Overrides org.HdrHistogram.Histogram.copy.

Create a copy of this histogram, complete with data and everything.
public synchronized SynchronizedHistogram
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.HdrHistogram.Histogram.copyCorrectedForCoordinatedOmission.

Get a copy of this histogram, corrected for coordinated omission.
public void
copyInto(final AbstractHistogram
the histogram to copy into
targetHistogram
)

Overrides org.HdrHistogram.AbstractHistogram.copyInto.

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
)

Overrides org.HdrHistogram.AbstractHistogram.copyIntoCorrectedForCoordinatedOmission.

Copy this histogram, corrected for coordinated omission, into the target histogram, overwriting it's contents.
public static SynchronizedHistogram

Returns:

The newly constructed histogram
decodeFromByteBuffer
(final ByteBuffer
The buffer to decode from
buffer
,
final long
Force highestTrackableValue to be set at least this high
minBarForHighestTrackableValue
)

Hides org.HdrHistogram.Histogram.decodeFromByteBuffer.

Construct a new histogram by decoding it from a ByteBuffer.
public static SynchronizedHistogram

Returns:

The newly constructed histogram
decodeFromCompressedByteBuffer
(final ByteBuffer
The buffer to decode from
buffer
,
final long
Force highestTrackableValue to be set at least this high
minBarForHighestTrackableValue
)

Hides org.HdrHistogram.Histogram.decodeFromCompressedByteBuffer.

Construct a new histogram by decoding it from a compressed form in a ByteBuffer.
public synchronized int
encodeIntoByteBuffer(final ByteBuffer
The buffer to encode into
buffer
)

Overrides org.HdrHistogram.AbstractHistogram.encodeIntoByteBuffer.

Encode this histogram into a ByteBuffer
public synchronized int
encodeIntoCompressedByteBuffer(final ByteBuffer
The buffer to encode into
targetBuffer
,
final int
Compression level (for java.util.zip.Deflater).
compressionLevel
)

Overrides org.HdrHistogram.AbstractHistogram.encodeIntoCompressedByteBuffer.

Encode this histogram in compressed form into a byte array
public synchronized int
encodeIntoCompressedByteBuffer(final ByteBuffer
The buffer to encode into
targetBuffer
)

Overrides org.HdrHistogram.AbstractHistogram.encodeIntoCompressedByteBuffer.

Encode this histogram in compressed form into a byte array
public boolean
equals(final Object
the other histogram to compare to
other
)

Overrides org.HdrHistogram.AbstractHistogram.equals.

Determine if this histogram is equivalent to another.
public static SynchronizedHistogram

Returns:

A SynchronizedHistogram decoded from the string
fromString
(final String
A string containing a base64 encoding of a compressed histogram
base64CompressedHistogramString
)

Hides org.HdrHistogram.Histogram.fromString.

Construct a new SynchronizedHistogram by decoding it from a String containing a base64 encoded compressed histogram representation.
public synchronized long
getCountAtValue(final long
The value for which to provide the recorded count
value
)

Overrides org.HdrHistogram.AbstractHistogram.getCountAtValue.

Get the count of recorded values at a specific value (to within the histogram resolution at the value level).
public synchronized long
getCountBetweenValues(final long
The lower value bound on the range for which to provide the recorded count. Will be rounded down with lowestEquivalentValue.
lowValue
,
final long
The higher value bound on the range for which to provide the recorded count. Will be rounded up with highestEquivalentValue.
highValue
)

Overrides org.HdrHistogram.AbstractHistogram.getCountBetweenValues.

Get the count of recorded values within a range of value levels (inclusive to within the histogram's resolution).
public synchronized long
getEndTimeStamp()

Overrides org.HdrHistogram.AbstractHistogram.getEndTimeStamp.

get the end time stamp [optionally] stored with this histogram
public synchronized int
getEstimatedFootprintInBytes()

Overrides org.HdrHistogram.AbstractHistogram.getEstimatedFootprintInBytes.

Provide a (conservatively high) estimate of the Histogram's total footprint in bytes
public synchronized long
public synchronized long
public synchronized long
getMaxValue()

Overrides org.HdrHistogram.AbstractHistogram.getMaxValue.

Get the highest recorded value level in the histogram.
public synchronized double
getMaxValueAsDouble()

Overrides org.HdrHistogram.AbstractHistogram.getMaxValueAsDouble.

Get the highest recorded value level in the histogram as a double
public synchronized double
getMean()

Overrides org.HdrHistogram.AbstractHistogram.getMean.

Get the computed mean value of all recorded values in the histogram
public synchronized long
getMinNonZeroValue()

Overrides org.HdrHistogram.AbstractHistogram.getMinNonZeroValue.

Get the lowest recorded non-zero value level in the histogram.
public synchronized long
getMinValue()

Overrides org.HdrHistogram.AbstractHistogram.getMinValue.

Get the lowest recorded value level in the histogram.
public synchronized int
getNeededByteBufferCapacity()

Overrides org.HdrHistogram.AbstractHistogram.getNeededByteBufferCapacity.

Get the capacity needed to encode this histogram into a ByteBuffer
public synchronized int
public synchronized double
getPercentileAtOrBelowValue(final long
The value for which to return the associated percentile
value
)

Overrides org.HdrHistogram.AbstractHistogram.getPercentileAtOrBelowValue.

Get the percentile at a given value.
public synchronized long
getStartTimeStamp()

Overrides org.HdrHistogram.AbstractHistogram.getStartTimeStamp.

get the start time stamp [optionally] stored with this histogram
public synchronized double
getStdDeviation()

Overrides org.HdrHistogram.AbstractHistogram.getStdDeviation.

Get the computed standard deviation of all recorded values in the histogram
public synchronized long
getTotalCount()

Overrides org.HdrHistogram.Histogram.getTotalCount.

Get the total count of all recorded values in the histogram
public synchronized long
getValueAtPercentile(final double
The percentile for which to return the associated value
percentile
)

Overrides org.HdrHistogram.AbstractHistogram.getValueAtPercentile.

Get the value at a given percentile.
public synchronized int
hashCode()

Overrides org.HdrHistogram.AbstractHistogram.hashCode.

Returns a hash code value for the object.
public synchronized long
highestEquivalentValue(final long
The given value
value
)

Overrides org.HdrHistogram.AbstractHistogram.highestEquivalentValue.

Get the highest value that is equivalent to the given value within the histogram's resolution.
public synchronized boolean
isAutoResize()

Overrides org.HdrHistogram.AbstractHistogram.isAutoResize.

Indicate whether or not the histogram is set to auto-resize and auto-adjust it's highestTrackableValue
public synchronized AbstractHistogram.LinearBucketValues
linearBucketValues(final long
The size (in value units) of the linear buckets to use
valueUnitsPerBucket
)

Overrides org.HdrHistogram.AbstractHistogram.linearBucketValues.

Provide a means of iterating through histogram values using linear steps.
public synchronized AbstractHistogram.LogarithmicBucketValues
logarithmicBucketValues(final long
The 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
)

Overrides org.HdrHistogram.AbstractHistogram.logarithmicBucketValues.

Provide a means of iterating through histogram values at logarithmically increasing levels.
public synchronized long
lowestEquivalentValue(final long
The given value
value
)

Overrides org.HdrHistogram.AbstractHistogram.lowestEquivalentValue.

Get the lowest value that is equivalent to the given value within the histogram's resolution.
public synchronized long
medianEquivalentValue(final long
The given value
value
)

Overrides org.HdrHistogram.AbstractHistogram.medianEquivalentValue.

Get a value that lies in the middle (rounded up) of the range of values equivalent the given value.
public synchronized long
nextNonEquivalentValue(final long
The given value
value
)

Overrides org.HdrHistogram.AbstractHistogram.nextNonEquivalentValue.

Get the next value that is not equivalent to the given value within the histogram's resolution.
public synchronized 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
)

Overrides org.HdrHistogram.AbstractHistogram.outputPercentileDistribution.

Produce textual representation of the value distribution of histogram data by percentile.
public synchronized 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
)

Overrides org.HdrHistogram.AbstractHistogram.outputPercentileDistribution.

Produce textual representation of the value distribution of histogram data by percentile.
public synchronized 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
)

Overrides org.HdrHistogram.AbstractHistogram.outputPercentileDistribution.

Produce textual representation of the value distribution of histogram data by percentile.
public synchronized AbstractHistogram.Percentiles
percentiles(final int
The number of iteration steps per half-distance to 100%.
percentileTicksPerHalfDistance
)

Overrides org.HdrHistogram.AbstractHistogram.percentiles.

Provide a means of iterating through histogram values according to percentile levels.
private void
public synchronized AbstractHistogram.RecordedValues
recordedValues()

Overrides org.HdrHistogram.AbstractHistogram.recordedValues.

Provide a means of iterating through all recorded histogram values using the finest granularity steps supported by the underlying representation.
public synchronized void
recordValue(final long
The value to be recorded
value
)

Overrides org.HdrHistogram.AbstractHistogram.recordValue.

Implements org.HdrHistogram.ValueRecorder.recordValue.

Record a value in the histogram
public synchronized 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
)

Overrides org.HdrHistogram.AbstractHistogram.recordValue.

Deprecated
public synchronized void
recordValueWithCount(final long
The value to be recorded
value
,
final long
The number of occurrences of this value to record
count
)

Overrides org.HdrHistogram.AbstractHistogram.recordValueWithCount.

Implements org.HdrHistogram.ValueRecorder.recordValueWithCount.

Record a value in the histogram (adding to the value's current count)
public synchronized 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
)

Overrides org.HdrHistogram.AbstractHistogram.recordValueWithExpectedInterval.

Implements org.HdrHistogram.ValueRecorder.recordValueWithExpectedInterval.

Record a value in the histogram.
public synchronized void
reset()

Overrides org.HdrHistogram.AbstractHistogram.reset.

Implements org.HdrHistogram.ValueRecorder.reset.

Reset the contents and stats of this histogram
public synchronized void
setAutoResize(boolean
autoResize setting
autoResize
)

Overrides org.HdrHistogram.AbstractHistogram.setAutoResize.

Control whether or not the histogram can auto-resize and auto-adjust it's highestTrackableValue
public synchronized void
setEndTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch.
timeStampMsec
)

Overrides org.HdrHistogram.AbstractHistogram.setEndTimeStamp.

Set the end time stamp value associated with this histogram to a given value.
public synchronized void
setStartTimeStamp(final long
the value to set the time stamp to, [by convention] in msec since the epoch.
timeStampMsec
)

Overrides org.HdrHistogram.AbstractHistogram.setStartTimeStamp.

Set the start time stamp value associated with this histogram to a given value.
public synchronized void
shiftValuesLeft(final int
The number of binary orders of magnitude to shift by
numberOfBinaryOrdersOfMagnitude
)

Overrides org.HdrHistogram.AbstractHistogram.shiftValuesLeft.

Shift recorded values to the left (the equivalent of a << shift operation on all recorded values).
public synchronized void
shiftValuesRight(final int
The number of binary orders of magnitude to shift by
numberOfBinaryOrdersOfMagnitude
)

Overrides org.HdrHistogram.AbstractHistogram.shiftValuesRight.

Shift recorded values to the right (the equivalent of a >> shift operation on all recorded values).
public synchronized long
sizeOfEquivalentValueRange(final long
The given value
value
)

Overrides org.HdrHistogram.AbstractHistogram.sizeOfEquivalentValueRange.

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
)

Overrides org.HdrHistogram.AbstractHistogram.subtract.

Subtract the contents of another histogram from this one.
public synchronized boolean
valuesAreEquivalent(final long
first value to compare
value1
,
final long
second value to compare
value2
)

Overrides org.HdrHistogram.AbstractHistogram.valuesAreEquivalent.

Determine if two values are equivalent with the histogram's resolution.
Inherited from org.HdrHistogram.Histogram:
_getEstimatedFootprintInBytesaddToCountAtIndexaddToTotalCountclearCountsgetCountAtIndexgetCountAtNormalizedIndexgetNormalizingIndexOffsetincrementCountAtIndexincrementTotalCountresizesetCountAtIndexsetCountAtNormalizedIndexsetIntegerToDoubleValueConversionRatiosetNormalizingIndexOffsetsetTotalCountshiftNormalizingIndexByOffset