HdrHistogram.HistogramBase.ValueFromIndex C# (CSharp) Méthode

ValueFromIndex() private méthode

private ValueFromIndex ( int index ) : long
index int
Résultat long
        private long ValueFromIndex(int index)
        {
            var bucketIndex = (index >> _subBucketHalfCountMagnitude) - 1;
            var subBucketIndex = (index & (SubBucketHalfCount - 1)) + SubBucketHalfCount;
            if (bucketIndex < 0)
            {
                subBucketIndex -= SubBucketHalfCount;
                bucketIndex = 0;
            }
            return ValueFromIndex(bucketIndex, subBucketIndex);
        }

Same methods

HistogramBase::ValueFromIndex ( int bucketIndex, int subBucketIndex ) : long

Usage Example

Exemple #1
0
 /// <summary>
 /// Add the contents of another histogram to this one.
 /// </summary>
 /// <param name="fromHistogram">The other histogram.</param>
 /// <exception cref="System.IndexOutOfRangeException">if values in fromHistogram's are higher than highestTrackableValue.</exception>
 public virtual void Add(HistogramBase fromHistogram)
 {
     if (HighestTrackableValue < fromHistogram.HighestTrackableValue)
     {
         throw new ArgumentOutOfRangeException(nameof(fromHistogram), $"The other histogram covers a wider range ({fromHistogram.HighestTrackableValue} than this one ({HighestTrackableValue}).");
     }
     if ((BucketCount == fromHistogram.BucketCount) &&
         (SubBucketCount == fromHistogram.SubBucketCount) &&
         (_unitMagnitude == fromHistogram._unitMagnitude))
     {
         // Counts arrays are of the same length and meaning, so we can just iterate and add directly:
         for (var i = 0; i < fromHistogram.CountsArrayLength; i++)
         {
             AddToCountAtIndex(i, fromHistogram.GetCountAtIndex(i));
         }
     }
     else
     {
         // Arrays are not a direct match, so we can't just stream through and add them.
         // Instead, go through the array and add each non-zero value found at it's proper value:
         for (var i = 0; i < fromHistogram.CountsArrayLength; i++)
         {
             var count = fromHistogram.GetCountAtIndex(i);
             RecordValueWithCount(fromHistogram.ValueFromIndex(i), count);
         }
     }
 }
All Usage Examples Of HdrHistogram.HistogramBase::ValueFromIndex