HdrHistogram.HistogramBase.RecordValueWithCount C# (CSharp) Method

RecordValueWithCount() public method

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
return void
        public void RecordValueWithCount(long value, long count)
        {
            // Dissect the value into bucket and sub-bucket parts, and derive index into counts array:
            var bucketIndex = GetBucketIndex(value);
            var subBucketIndex = GetSubBucketIndex(value, bucketIndex);
            var countsIndex = CountsArrayIndex(bucketIndex, subBucketIndex);
            AddToCountAtIndex(countsIndex, count);
        }

Usage Example

示例#1
0
        /// <summary>
        /// Record a value in the histogram (adding to the value's current count)
        /// </summary>
        /// <param name="value">The value to be recorded</param>
        /// <param name="count">The number of occurrences of this value to record</param>
        /// <exception cref="System.IndexOutOfRangeException">if value is exceeds highestTrackableValue</exception>
        public void RecordValueWithCount(long value, long count)
        {
            var criticalValueAtEnter = _recordingPhaser.WriterCriticalSectionEnter();

            try
            {
                _activeHistogram.RecordValueWithCount(value, count);
            }
            finally
            {
                _recordingPhaser.WriterCriticalSectionExit(criticalValueAtEnter);
            }
        }