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); }
/// <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); } }