C# Class HdrHistogram.Recorder

Records integer values, and provides stable interval HistogramBase 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. Recording calls are wait-free on architectures that support atomic increment operations, and are lock-free on architectures that do not.
Inheritance: IRecorder
Afficher le fichier Open project: HdrHistogram/HdrHistogram.NET

Méthodes publiques

Méthode Description
GetIntervalHistogram ( ) : HistogramBase

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. Calling GetIntervalHistogram() will reset the value counts, and start accumulating value counts for the next interval.

GetIntervalHistogram ( HistogramBase histogramToRecycle ) : HistogramBase

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. Calling GetIntervalHistogram() will reset the value counts, and start accumulating value counts for the next interval.

GetIntervalHistogram(HistogramBase) accepts a previously returned interval histogram that can be recycled internally to avoid allocation and content copying operations. It is therefore significantly more efficient for repeated use than GetIntervalHistogram() and GetIntervalHistogramInto(HistogramBase). The provided histogramToRecycle must be either be null or an interval histogram returned by a previous call to GetIntervalHistogram(HistogramBase) 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.

GetIntervalHistogramInto ( HistogramBase targetHistogram ) : void

Place a copy of the value counts accumulated since accumulated (since the last interval histogram was taken) into targetHistogram. This will overwrite the existing data in targetHistogram. Calling GetIntervalHistogramInto(HistogramBase) will reset the value counts, and start accumulating value counts for the next interval.

RecordValue ( long value ) : void

Records a value in the histogram

RecordValueWithCount ( long value, long count ) : void

Record a value in the histogram (adding to the value's current count)

RecordValueWithExpectedInterval ( long value, long expectedIntervalBetweenValueSamples ) : void

Record a value in the histogram.

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.

Note: This is a at-recording correction method, as opposed to the post-recording correction method provided by CopyCorrectedForCoordinatedOmission. The two methods are mutually exclusive, and only one of the two should be be used on a given data set to correct for the same coordinated omission issue.

See notes in the description of the Histogram calls for an illustration of why this corrective behavior is important.
Recorder ( long lowestDiscernibleValue, long highestTrackableValue, int numberOfSignificantValueDigits, HistogramFactoryDelegate histogramFactory ) : System

Creates a recorder that will delegate recording to histograms created from these parameters.

Reset ( ) : void

Reset any value counts accumulated thus far.

Private Methods

Méthode Description
PerformIntervalSample ( ) : void
ValidateFitAsReplacementHistogram ( HistogramBase replacementHistogram ) : void

Method Details

GetIntervalHistogram() public méthode

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. Calling GetIntervalHistogram() will reset the value counts, and start accumulating value counts for the next interval.
public GetIntervalHistogram ( ) : HistogramBase
Résultat HistogramBase

GetIntervalHistogram() public méthode

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. Calling GetIntervalHistogram() will reset the value counts, and start accumulating value counts for the next interval.
GetIntervalHistogram(HistogramBase) accepts a previously returned interval histogram that can be recycled internally to avoid allocation and content copying operations. It is therefore significantly more efficient for repeated use than GetIntervalHistogram() and GetIntervalHistogramInto(HistogramBase). The provided histogramToRecycle must be either be null or an interval histogram returned by a previous call to GetIntervalHistogram(HistogramBase) 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.
public GetIntervalHistogram ( HistogramBase histogramToRecycle ) : HistogramBase
histogramToRecycle HistogramBase a previously returned interval histogram that may be recycled to avoid allocation and copy operations.
Résultat HistogramBase

GetIntervalHistogramInto() public méthode

Place a copy of the value counts accumulated since accumulated (since the last interval histogram was taken) into targetHistogram. This will overwrite the existing data in targetHistogram. Calling GetIntervalHistogramInto(HistogramBase) will reset the value counts, and start accumulating value counts for the next interval.
public GetIntervalHistogramInto ( HistogramBase targetHistogram ) : void
targetHistogram HistogramBase The histogram into which the interval histogram's data should be copied.
Résultat void

RecordValue() public méthode

Records a value in the histogram
if value is exceeds highestTrackableValue
public RecordValue ( long value ) : void
value long The value to be recorded
Résultat void

RecordValueWithCount() public méthode

Record a value in the histogram (adding to the value's current count)
if value is exceeds highestTrackableValue
public RecordValueWithCount ( long value, long count ) : void
value long The value to be recorded
count long The number of occurrences of this value to record
Résultat void

RecordValueWithExpectedInterval() public méthode

Record a value in the histogram.
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.

Note: This is a at-recording correction method, as opposed to the post-recording correction method provided by CopyCorrectedForCoordinatedOmission. The two methods are mutually exclusive, and only one of the two should be be used on a given data set to correct for the same coordinated omission issue.

See notes in the description of the Histogram calls for an illustration of why this corrective behavior is important.
if value is exceeds highestTrackableValue
public RecordValueWithExpectedInterval ( long value, long expectedIntervalBetweenValueSamples ) : void
value long The value to record
expectedIntervalBetweenValueSamples long If is larger than 0, add auto-generated value records as appropriate if is larger than
Résultat void

Recorder() public méthode

Creates a recorder that will delegate recording to histograms created from these parameters.
public Recorder ( long lowestDiscernibleValue, long highestTrackableValue, int numberOfSignificantValueDigits, HistogramFactoryDelegate histogramFactory ) : System
lowestDiscernibleValue 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. ///
highestTrackableValue long The highest value to be tracked by the histogram. /// Must be a positive integer that is >= (2 * lowestTrackableValue). ///
numberOfSignificantValueDigits 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. ///
histogramFactory HistogramFactoryDelegate The factory to be used to actually create instances of .
Résultat System

Reset() public méthode

Reset any value counts accumulated thus far.
public Reset ( ) : void
Résultat void