Beispiel #1
0
        /**
         * Returns the next element in the iteration.
         *
         * @return the {@link HistogramIterationValue} associated with the next element in the iteration.
         */

        public override HistogramIterationValue next()
        {
            // Move through the sub buckets and buckets until we hit the next reporting level:
            while (!ExhaustedSubBuckets())
            {
                CountAtThisValue = Histogram.getCountAtIndex(CurrentIndex);
                if (_freshSubBucket)
                {
                    // Don't add unless we've incremented since last bucket...
                    TotalCountToCurrentIndex  += CountAtThisValue;
                    _totalValueToCurrentIndex += CountAtThisValue * Histogram.highestEquivalentValue(CurrentValueAtIndex);
                    _freshSubBucket            = false;
                }
                if (ReachedIterationLevel())
                {
                    var valueIteratedTo = GetValueIteratedTo();
                    CurrentIterationValue.Set(valueIteratedTo, _prevValueIteratedTo, CountAtThisValue,
                                              (TotalCountToCurrentIndex - _totalCountToPrevIndex), TotalCountToCurrentIndex,
                                              _totalValueToCurrentIndex, ((100.0 * TotalCountToCurrentIndex) / ArrayTotalCount),
                                              GetPercentileIteratedTo(), _integerToDoubleValueConversionRatio);
                    _prevValueIteratedTo   = valueIteratedTo;
                    _totalCountToPrevIndex = TotalCountToCurrentIndex;
                    // move the next iteration level forward:
                    IncrementIterationLevel();
                    if (Histogram.getTotalCount() != SavedHistogramTotalRawCount)
                    {
                        throw new InvalidOperationException("ConcurrentModificationException");
                    }
                    return(CurrentIterationValue);
                }
                IncrementSubBucket();
            }
            // Should not reach here. But possible for overflowed histograms under certain conditions
            throw new IndexOutOfRangeException();
        }
Beispiel #2
0
        /**
         * Returns the next element in the iteration.
         *
         * @return the {@link HistogramIterationValue} associated with the next element in the iteration.
         */

        public override HistogramIterationValue next()
        {
            // Move through the sub buckets and buckets until we hit the next reporting level:
            while (!exhaustedSubBuckets())
            {
                countAtThisValue = histogram.getCountAtIndex(currentIndex);
                if (freshSubBucket)
                { // Don't add unless we've incremented since last bucket...
                    totalCountToCurrentIndex += countAtThisValue;
                    totalValueToCurrentIndex += countAtThisValue * histogram.highestEquivalentValue(currentValueAtIndex);
                    freshSubBucket            = false;
                }
                if (reachedIterationLevel())
                {
                    long valueIteratedTo = getValueIteratedTo();
                    currentIterationValue.set(valueIteratedTo, prevValueIteratedTo, countAtThisValue,
                                              (totalCountToCurrentIndex - totalCountToPrevIndex), totalCountToCurrentIndex,
                                              totalValueToCurrentIndex, ((100.0 * totalCountToCurrentIndex) / arrayTotalCount),
                                              getPercentileIteratedTo(), integerToDoubleValueConversionRatio);
                    prevValueIteratedTo   = valueIteratedTo;
                    totalCountToPrevIndex = totalCountToCurrentIndex;
                    // move the next iteration level forward:
                    incrementIterationLevel();
                    if (histogram.getTotalCount() != savedHistogramTotalRawCount)
                    {
                        throw new InvalidOperationException("ConcurrentModificationException");
                    }
                    return(currentIterationValue);
                }
                incrementSubBucket();
            }
            // Should not reach here. But possible for overflowed histograms under certain conditions
            throw new IndexOutOfRangeException();
        }