public void testScalingEquivalence()
 {
     Assert.assertEquals("averages should be equivalent",
                         histogram.getMean() * 512,
                         scaledHistogram.getMean(), scaledHistogram.getMean() * 0.000001);
     Assert.assertEquals("total count should be the same",
                         histogram.getTotalCount(),
                         scaledHistogram.getTotalCount());
     Assert.assertEquals("99%'iles should be equivalent",
                         histogram.lowestEquivalentValue(histogram.getValueAtPercentile(99.0)) * 512,
                         scaledHistogram.lowestEquivalentValue(scaledHistogram.getValueAtPercentile(99.0)));
     Assert.assertEquals("Max should be equivalent",
                         histogram.getMaxValue() * 512,
                         scaledHistogram.getMaxValue());
     // Same for post-corrected:
     Assert.assertEquals("averages should be equivalent",
                         histogram.getMean() * 512,
                         scaledHistogram.getMean(), scaledHistogram.getMean() * 0.000001);
     Assert.assertEquals("total count should be the same",
                         postCorrectedHistogram.getTotalCount(),
                         postCorrectedScaledHistogram.getTotalCount());
     Assert.assertEquals("99%'iles should be equivalent",
                         postCorrectedHistogram.lowestEquivalentValue(postCorrectedHistogram.getValueAtPercentile(99.0)) * 512,
                         postCorrectedScaledHistogram.lowestEquivalentValue(postCorrectedScaledHistogram.getValueAtPercentile(99.0)));
     Assert.assertEquals("Max should be equivalent",
                         postCorrectedHistogram.getMaxValue() * 512,
                         postCorrectedScaledHistogram.getMaxValue());
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HdrSnapshot"/> class.
 /// </summary>
 /// <param name="histogram">The histogram.</param>
 /// <param name="minValue">The minimum value.</param>
 /// <param name="minUserValue">The minimum user value.</param>
 /// <param name="maxValue">The maximum value.</param>
 /// <param name="maxUserValue">The maximum user value.</param>
 public HdrSnapshot(AbstractHistogram histogram, long minValue, string minUserValue, long maxValue, string maxUserValue)
 {
     _histogram   = histogram;
     Min          = minUserValue.IsPresent() ? minValue : _histogram.getMinValue();
     MinUserValue = minUserValue;
     Max          = maxUserValue.IsPresent() ? maxValue : _histogram.getMaxValue();
     MaxUserValue = maxUserValue;
 }