C# Class HdrHistogram.IntHistogram

A High Dynamic Range (HDR) Histogram using an int count type.
Histogram supports the recording and analyzing sampled data value counts across a configurable integer value range with configurable value precision within the range. Value precision is expressed as the number of significant 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.

For example, a Histogram could be configured to track the counts of observed integer values between 0 and 36,000,000,000 while maintaining a value precision of 3 significant digits across that range. Value quantization within the range will thus be no larger than 1/1,000th (or 0.1%) of any value. This example Histogram could be used to track and analyze the counts of observed response times ranging between 1 tick (100 nanoseconds) and 1 hour in magnitude, while maintaining a value resolution of 100 nanosecond up to 100 microseconds, a resolution of 1 millisecond(or better) up to one second, and a resolution of 1 second (or better) up to 1,000 seconds. At it's maximum tracked value(1 hour), it would still maintain a resolution of 3.6 seconds (or better).

Histogram tracks value counts in int fields. Other field types are available in the LongHistogram and ShortHistogram implementations of HistogramBase.
Inheritance: HistogramBase
Exibir arquivo Open project: HdrHistogram/HdrHistogram.NET Class Usage Examples

Public Methods

Method Description
Copy ( ) : HistogramBase

Create a copy of this histogram, complete with data and everything.

IntHistogram ( long highestTrackableValue, int numberOfSignificantValueDigits ) : System

Construct an IntHistogram given the highest value to be tracked and a number of significant decimal digits. The histogram will be constructed to implicitly track(distinguish from 0) values as low as 1.

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

Construct a IntHistogram 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.

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

Construct a IntHistogram 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

Create a copy of this histogram, complete with data and everything.
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

IntHistogram() public method

Construct an IntHistogram given the highest value to be tracked and a number of significant decimal digits. The histogram will be constructed to implicitly track(distinguish from 0) values as low as 1.
public IntHistogram ( long highestTrackableValue, int numberOfSignificantValueDigits ) : System
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

IntHistogram() public method

Construct a IntHistogram 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 IntHistogram ( 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

IntHistogram() public method

Construct a IntHistogram 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 IntHistogram ( 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