Top Description Fields Constructors Methods
org.HdrHistogram

public Class SynchronizedDoubleHistogram

extends DoubleHistogram
Class Inheritance
Imports
java.io.PrintStream, java.nio.ByteBuffer

A floating point values High Dynamic Range (HDR) Histogram that is synchronized as a whole

A SynchronizedDoubleHistogram is a variant of org.HdrHistogram.DoubleHistogram that is synchronized as a whole, such that queries, copying, and addition operations are atomic with relation to modification on the SynchronizedDoubleHistogram, nd such that external accessors (e.g. iterations on the histogram data) that synchronize on the SynchronizedDoubleHistogram 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 org.HdrHistogram.ConcurrentDoubleHistogram, or (recommended) DoubleRecorder which were intended for concurrent operations.

SynchronizedDoubleHistogram 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 SynchronizedDoubleHistogram is not specified upfront. Only the dynamic range of values that the histogram can cover is (optionally) specified. E.g. When a ConcurrentDoubleHistogram 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 SynchronizedDoubleHistogram#setAutoResize) a SynchronizedDoubleHistogram 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.HdrHistogram for details.

Field Summary

Inherited from org.HdrHistogram.DoubleHistogram:
integerValuesHistogram

Constructor Summary

AccessConstructor and Description
public
SynchronizedDoubleHistogram(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
SynchronizedDoubleHistogram(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 highestToLowestValueRatio) and using a precision stated as a number of significant decimal digits.

public
SynchronizedDoubleHistogram(final ConcurrentDoubleHistogram
The source histogram to duplicate
source
)

Construct a SynchronizedDoubleHistogram with the same range settings as a given source, duplicating the source's start/end timestamps (but NOT it's contents)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
add(final DoubleHistogram
The other histogram.
fromHistogram
)

Overrides org.HdrHistogram.DoubleHistogram.add.

Add the contents of another histogram to this one.
public synchronized 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
)

Overrides org.HdrHistogram.DoubleHistogram.addWhileCorrectingForCoordinatedOmission.

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

Overrides org.HdrHistogram.DoubleHistogram.allValues.

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

Overrides org.HdrHistogram.DoubleHistogram.copy.

Create a copy of this histogram, complete with data and everything.
public synchronized DoubleHistogram
copyCorrectedForCoordinatedOmission(final double
If expectedIntervalBetweenValueSamples is larger than 0, add auto-generated value records as appropriate if value is larger than expectedIntervalBetweenValueSamples
expectedIntervalBetweenValueSamples
)

Overrides org.HdrHistogram.DoubleHistogram.copyCorrectedForCoordinatedOmission.

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

Overrides org.HdrHistogram.DoubleHistogram.copyInto.

Copy this histogram into the target histogram, overwriting it's contents.
public synchronized 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
)

Overrides org.HdrHistogram.DoubleHistogram.copyIntoCorrectedForCoordinatedOmission.

Copy this histogram, corrected for coordinated omission, into the target histogram, overwriting it's contents.
public synchronized int
encodeIntoByteBuffer(final ByteBuffer
The buffer to encode into
buffer
)

Overrides org.HdrHistogram.DoubleHistogram.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.DoubleHistogram.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.DoubleHistogram.encodeIntoCompressedByteBuffer.

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

Overrides org.HdrHistogram.DoubleHistogram.equals.

Determine if this histogram is equivalent to another.
public synchronized long
getCountAtValue(final double
The value for which to provide the recorded count
value
)

Overrides org.HdrHistogram.DoubleHistogram.getCountAtValue.

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

Overrides org.HdrHistogram.DoubleHistogram.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.DoubleHistogram.getEndTimeStamp.

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

Overrides org.HdrHistogram.DoubleHistogram.getEstimatedFootprintInBytes.

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

Overrides org.HdrHistogram.DoubleHistogram.getHighestToLowestValueRatio.

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 synchronized double
getIntegerToDoubleValueConversionRatio()

Overrides org.HdrHistogram.DoubleHistogram.getIntegerToDoubleValueConversionRatio.

Get the current conversion ratio from interval integer value representation to double units.
public synchronized double
getMaxValue()

Overrides org.HdrHistogram.DoubleHistogram.getMaxValue.

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

Overrides org.HdrHistogram.DoubleHistogram.getMaxValueAsDouble.

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

Overrides org.HdrHistogram.DoubleHistogram.getMean.

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

Overrides org.HdrHistogram.DoubleHistogram.getMinNonZeroValue.

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

Overrides org.HdrHistogram.DoubleHistogram.getMinValue.

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

Overrides org.HdrHistogram.DoubleHistogram.getNeededByteBufferCapacity.

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

Overrides org.HdrHistogram.DoubleHistogram.getPercentileAtOrBelowValue.

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

Overrides org.HdrHistogram.DoubleHistogram.getStartTimeStamp.

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

Overrides org.HdrHistogram.DoubleHistogram.getStdDeviation.

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

Overrides org.HdrHistogram.DoubleHistogram.getTotalCount.

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

Overrides org.HdrHistogram.DoubleHistogram.getValueAtPercentile.

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

Overrides org.HdrHistogram.DoubleHistogram.hashCode.

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

Overrides org.HdrHistogram.DoubleHistogram.highestEquivalentValue.

Get the highest value that is equivalent to the given value within the histogram's resolution.
public synchronized boolean
public synchronized DoubleHistogram.LinearBucketValues
linearBucketValues(final double
The size (in value units) of the linear buckets to use
valueUnitsPerBucket
)

Overrides org.HdrHistogram.DoubleHistogram.linearBucketValues.

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

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

Overrides org.HdrHistogram.DoubleHistogram.lowestEquivalentValue.

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

Overrides org.HdrHistogram.DoubleHistogram.medianEquivalentValue.

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

Overrides org.HdrHistogram.DoubleHistogram.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.DoubleHistogram.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.DoubleHistogram.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.DoubleHistogram.outputPercentileDistribution.

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

Overrides org.HdrHistogram.DoubleHistogram.percentiles.

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

Overrides org.HdrHistogram.DoubleHistogram.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 double
The value to be recorded
value
)

Overrides org.HdrHistogram.DoubleHistogram.recordValue.

Implements org.HdrHistogram.DoubleValueRecorder.recordValue.

Record a value in the histogram
public synchronized void
recordValueWithCount(final double
The value to be recorded
value
,
final long
The number of occurrences of this value to record
count
)

Overrides org.HdrHistogram.DoubleHistogram.recordValueWithCount.

Implements org.HdrHistogram.DoubleValueRecorder.recordValueWithCount.

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

Overrides org.HdrHistogram.DoubleHistogram.recordValueWithExpectedInterval.

Implements org.HdrHistogram.DoubleValueRecorder.recordValueWithExpectedInterval.

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

Overrides org.HdrHistogram.DoubleHistogram.reset.

Implements org.HdrHistogram.DoubleValueRecorder.reset.

Reset the contents and stats of this histogram
public synchronized void
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.DoubleHistogram.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.DoubleHistogram.setStartTimeStamp.

Set the start time stamp value associated with this histogram to a given value.
public synchronized double
sizeOfEquivalentValueRange(final double
The given value
value
)

Overrides org.HdrHistogram.DoubleHistogram.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 synchronized void
subtract(final DoubleHistogram
The other histogram.
fromHistogram
)

Overrides org.HdrHistogram.DoubleHistogram.subtract.

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

Overrides org.HdrHistogram.DoubleHistogram.valuesAreEquivalent.

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