|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.HdrHistogram.DoubleRecorder
public class DoubleRecorder
Records floating point (double) values, and provides stable
interval DoubleHistogram samples from live recorded data without interrupting or stalling active recording
of values. Each interval histogram provided contains all value counts accumulated since the
previous interval histogram was taken.
This pattern is commonly used in logging interval histogram information while recording is ongoing.
DoubleRecorder supports concurrent
recordValue(double) or
recordValueWithExpectedInterval(double, double) calls.
Recording calls are wait-free on architectures that support atomic increment operations, and
are lock-free on architectures that do not.
| Constructor Summary | |
|---|---|
DoubleRecorder(int numberOfSignificantValueDigits)
Construct an auto-resizing DoubleRecorder using a precision stated as a number
of significant decimal digits. |
|
DoubleRecorder(long highestToLowestValueRatio,
int numberOfSignificantValueDigits)
Construct a DoubleRecorder dynamic range of values to cover and a number of significant
decimal digits. |
|
| Method Summary | |
|---|---|
DoubleHistogram |
getIntervalHistogram()
Get a new instance of an interval histogram, which will include a stable, consistent view of all value counts accumulated since the last interval histogram was taken. |
DoubleHistogram |
getIntervalHistogram(DoubleHistogram histogramToRecycle)
Get an interval histogram, which will include a stable, consistent view of all value counts accumulated since the last interval histogram was taken. |
void |
getIntervalHistogramInto(DoubleHistogram targetHistogram)
Place a copy of the value counts accumulated since accumulated (since the last interval histogram was taken) into targetHistogram. |
void |
recordValue(double value)
Record a value |
void |
recordValueWithCount(double value,
long count)
Record a value in the histogram (adding to the value's current count) |
void |
recordValueWithExpectedInterval(double value,
double expectedIntervalBetweenValueSamples)
Record a value |
void |
reset()
Reset any value counts accumulated thus far. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DoubleRecorder(int numberOfSignificantValueDigits)
DoubleRecorder using a precision stated as a number
of significant decimal digits.
numberOfSignificantValueDigits - 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.
public DoubleRecorder(long highestToLowestValueRatio,
int numberOfSignificantValueDigits)
DoubleRecorder dynamic range of values to cover and a number of significant
decimal digits.
highestToLowestValueRatio - specifies the dynamic range to use (as a ratio)numberOfSignificantValueDigits - 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.| Method Detail |
|---|
public void recordValue(double value)
value - the value to record
ArrayIndexOutOfBoundsException - (may throw) if value is exceeds highestTrackableValue
public void recordValueWithCount(double value,
long count)
throws ArrayIndexOutOfBoundsException
value - The value to be recordedcount - The number of occurrences of this value to record
ArrayIndexOutOfBoundsException - (may throw) if value is exceeds highestTrackableValue
public void recordValueWithExpectedInterval(double value,
double expectedIntervalBetweenValueSamples)
throws ArrayIndexOutOfBoundsException
To compensate for the loss of sampled values when a recorded value is larger than the expected interval between value samples, Histogram will auto-generate an additional series of decreasingly-smaller (down to the expectedIntervalBetweenValueSamples) value records.
See related notes DoubleHistogram.recordValueWithExpectedInterval(double, double)
for more explanations about coordinated omission and expected interval correction.
*
value - The value to recordexpectedIntervalBetweenValueSamples - If expectedIntervalBetweenValueSamples is larger than 0, add
auto-generated value records as appropriate if value is larger
than expectedIntervalBetweenValueSamples
ArrayIndexOutOfBoundsException - (may throw) if value is exceeds highestTrackableValuepublic DoubleHistogram getIntervalHistogram()
Calling getIntervalHistogram() will reset
the value counts, and start accumulating value counts for the next interval.
public DoubleHistogram getIntervalHistogram(DoubleHistogram histogramToRecycle)
getIntervalHistogram(histogramToRecycle)
accepts a previously returned interval histogram that can be recycled internally to avoid allocation
and content copying operations, and is therefore significantly more efficient for repeated use than
getIntervalHistogram() and
getIntervalHistogramInto(). The provided
histogramToRecycle must
be either be null or an interval histogram returned by a previous call to
getIntervalHistogram(histogramToRecycle) or
getIntervalHistogram().
NOTE: The caller is responsible for not recycling the same returned interval histogram more than once. If the same interval histogram instance is recycled more than once, behavior is undefined.
Calling getIntervalHistogram(histogramToRecycle) will reset the value counts, and start accumulating value
counts for the next interval
histogramToRecycle - a previously returned interval histogram that may be recycled to avoid allocation and
copy operations.
public void getIntervalHistogramInto(DoubleHistogram targetHistogram)
targetHistogram.
Calling getIntervalHistogramInto(org.HdrHistogram.DoubleHistogram)() will reset
the value counts, and start accumulating value counts for the next interval.
targetHistogram - the histogram into which the interval histogram's data should be copiedpublic void reset()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||