I am using Java implementation of HDR Histogram:
<dependency>
<groupId>org.hdrhistogram</groupId>
<version>2.1.4</version>
<artifactId>HdrHistogram</artifactId>
</dependency>
I'v enoticed that minimum and maximum differ even when the sample count is 1:
@Test
public void testHistogram() throws Exception {
Histogram stats = new Histogram(2);
stats.recordValue(35071);
assertEquals(1, stats.getTotalCount());
assertEquals(35071, stats.getMaxValue());
assertEquals(35071, stats.getMinNonZeroValue()); // Fails:
// java.lang.AssertionError:
// Expected :35071
// Actual :34816
}
I see the following fragment in the Histogram code:
public long getMinNonZeroValue() {
return (minNonZeroValue == Long.MAX_VALUE) ?
Long.MAX_VALUE : lowestEquivalentValue(minNonZeroValue);
}
(That is in GitHub)
My question is: why can't we simply return the recorded minNonZeroValue
?