C# Class HdrHistogram.IntConcurrentHistogram

An integer values High Dynamic Range (HDR) Histogram that supports safe concurrent recording operations.
A IntConcurrentHistogram guarantees lossless recording of values into the histogram even when the histogram is updated by multiple threads.

It is important to note that concurrent recording is the only thread-safe behavior provided by IntConcurrentHistogram. It provides no implicit synchronization that would prevent the contents of the histogram from changing during other operations. These non-synchronised operations include queries, iterations, copies, or addition operations on the histogram. Concurrent updates that would safely work in the presence of queries, copies, or additions of histogram objects should use the Recorder which is intended for this purpose.

Inheritance: HistogramBase
Mostra file Open project: HdrHistogram/HdrHistogram.NET Class Usage Examples

Public Methods

Method Description
Copy ( ) : HistogramBase

Copies the data from this instance to a new instance.

IntConcurrentHistogram ( long lowestTrackableValue, long highestTrackableValue, int numberOfSignificantValueDigits ) : System

Construct a IntConcurrentHistogram given the lowest and highest values to be tracked and a number of significant decimal digits. Providing a lowestTrackableValue is useful is situations where the units used for the histogram's values are much smaller that the minimal accuracy required. For example when tracking time values stated in nanoseconds, where the minimal accuracy required is a microsecond, the proper value for lowestTrackableValue would be 1000.

IntConcurrentHistogram ( long instanceId, long lowestTrackableValue, long highestTrackableValue, int numberOfSignificantValueDigits ) : System

Construct a IntConcurrentHistogram given the lowest and highest values to be tracked and a number of significant decimal digits.

Providing a lowestTrackableValue is useful in situations where the units used for the histogram's values are much smaller that the minimal accuracy required. For example when tracking time values stated in ticks (100 nanoseconds), where the minimal accuracy required is a microsecond, the proper value for lowestTrackableValue would be 10.

Protected Methods

Method Description
AddToCountAtIndex ( int index, long addend ) : void

Adds the specified amount to the count of the provided index. Also increments the HistogramBase.TotalCount by the same amount.

ClearCounts ( ) : void

Clears the counts of this implementation.

CopyCountsInto ( long target ) : void

Copies the internal counts array into the supplied array.

GetCountAtIndex ( int index ) : long

Gets the number of recorded values at a given index.

IncrementCountAtIndex ( int index ) : void

Increments the count at the given index. Will also increment the HistogramBase.TotalCount.

SetCountAtIndex ( int index, long value ) : void

Sets the count at the given index.

Method Details

AddToCountAtIndex() protected method

Adds the specified amount to the count of the provided index. Also increments the HistogramBase.TotalCount by the same amount.
protected AddToCountAtIndex ( int index, long addend ) : void
index int The index to increment.
addend long The amount to increment by.
return void

ClearCounts() protected method

Clears the counts of this implementation.
protected ClearCounts ( ) : void
return void

Copy() public method

Copies the data from this instance to a new instance.
public Copy ( ) : HistogramBase
return HistogramBase

CopyCountsInto() protected method

Copies the internal counts array into the supplied array.
protected CopyCountsInto ( long target ) : void
target long The array to write each count value into.
return void

GetCountAtIndex() protected method

Gets the number of recorded values at a given index.
protected GetCountAtIndex ( int index ) : long
index int The index to get the count for
return long

IncrementCountAtIndex() protected method

Increments the count at the given index. Will also increment the HistogramBase.TotalCount.
protected IncrementCountAtIndex ( int index ) : void
index int The index to increment the count at.
return void

IntConcurrentHistogram() public method

Construct a IntConcurrentHistogram given the lowest and highest values to be tracked and a number of significant decimal digits. Providing a lowestTrackableValue is useful is situations where the units used for the histogram's values are much smaller that the minimal accuracy required. For example when tracking time values stated in nanoseconds, where the minimal accuracy required is a microsecond, the proper value for lowestTrackableValue would be 1000.
public IntConcurrentHistogram ( long lowestTrackableValue, long highestTrackableValue, int numberOfSignificantValueDigits ) : System
lowestTrackableValue 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 * ).
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.
return System

IntConcurrentHistogram() public method

Construct a IntConcurrentHistogram given the lowest and highest values to be tracked and a number of significant decimal digits.
Providing a lowestTrackableValue is useful in situations where the units used for the histogram's values are much smaller that the minimal accuracy required. For example when tracking time values stated in ticks (100 nanoseconds), where the minimal accuracy required is a microsecond, the proper value for lowestTrackableValue would be 10.
public IntConcurrentHistogram ( long instanceId, long lowestTrackableValue, long highestTrackableValue, int numberOfSignificantValueDigits ) : System
instanceId long An identifier for this instance.
lowestTrackableValue 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. ///
return System

SetCountAtIndex() protected method

Sets the count at the given index.
protected SetCountAtIndex ( int index, long value ) : void
index int The index to be set
value long The value to set
return void