/// <summary> /// The constructor for the <see cref="LogarithmicEnumerator"/> /// </summary> /// <param name="histogram">The histogram this iterator will operate on</param> /// <param name="valueUnitsInFirstBucket">the size (in value units) of the first value bucket step</param> /// <param name="logBase">the multiplier by which the bucket size is expanded in each iteration step.</param> public LogarithmicEnumerator(HistogramBase histogram, int valueUnitsInFirstBucket, double logBase) : base(histogram) { _logBase = logBase; _nextValueReportingLevel = valueUnitsInFirstBucket; _nextValueReportingLevelLowestEquivalent = histogram.LowestEquivalentValue(_nextValueReportingLevel); }
/// <summary> /// The constructor for the <see cref="LogarithmicEnumerator"/> /// </summary> /// <param name="histogram">The histogram this iterator will operate on</param> /// <param name="valueUnitsInFirstBucket">the size (in value units) of the first value bucket step</param> /// <param name="logBase">the multiplier by which the bucket size is expanded in each iteration step.</param> public LogarithmicEnumerator(HistogramBase histogram, int valueUnitsInFirstBucket, double logBase) : base(histogram) { _logBase = logBase; _nextValueReportingLevel = valueUnitsInFirstBucket; _nextValueReportingLevelLowestEquivalent = histogram.LowestEquivalentValue(_nextValueReportingLevel); }
public void TestScalingEquivalence() { Assert.AreEqual( LongHistogram.GetMean() * 512, ScaledHistogram.GetMean(), ScaledHistogram.GetMean() * 0.000001, "averages should be equivalent"); Assert.AreEqual( LongHistogram.TotalCount, ScaledHistogram.TotalCount, "total count should be the same"); Assert.AreEqual( LongHistogram.LowestEquivalentValue(LongHistogram.GetValueAtPercentile(99.0)) * 512, ScaledHistogram.LowestEquivalentValue(ScaledHistogram.GetValueAtPercentile(99.0)), "99%'iles should be equivalent"); Assert.AreEqual( ScaledHistogram.HighestEquivalentValue(LongHistogram.GetMaxValue() * 512), ScaledHistogram.GetMaxValue(), "Max should be equivalent for scaled data"); // Same for post-corrected: Assert.AreEqual( LongHistogram.GetMean() * 512, ScaledHistogram.GetMean(), ScaledHistogram.GetMean() * 0.000001, "averages should be equivalent"); Assert.AreEqual( PostCorrectedHistogram.TotalCount, PostCorrectedScaledHistogram.TotalCount, "total count should be the same"); Assert.AreEqual( PostCorrectedHistogram.LowestEquivalentValue(PostCorrectedHistogram.GetValueAtPercentile(99.0)) * 512, PostCorrectedScaledHistogram.LowestEquivalentValue(PostCorrectedScaledHistogram.GetValueAtPercentile(99.0)), "99%'iles should be equivalent"); Assert.AreEqual( PostCorrectedScaledHistogram.HighestEquivalentValue(PostCorrectedHistogram.GetMaxValue() * 512), PostCorrectedScaledHistogram.GetMaxValue(), "Max should be equivalent for post-corrected data"); }
/// <summary> /// The constructor for the <see cref="LinearEnumerator"/> /// </summary> /// <param name="histogram">The histogram this iterator will operate on</param> /// <param name="valueUnitsPerBucket">The size (in value units) of each bucket iteration.</param> public LinearEnumerator(HistogramBase histogram, int valueUnitsPerBucket) : base(histogram) { _valueUnitsPerBucket = valueUnitsPerBucket; _nextValueReportingLevel = valueUnitsPerBucket; _nextValueReportingLevelLowestEquivalent = histogram.LowestEquivalentValue(_nextValueReportingLevel); }
public static long GetMinValue(this HistogramBase histogram) { var min = histogram.RecordedValues().FirstOrDefault().ValueIteratedTo; return(histogram.LowestEquivalentValue(min)); }