Min/Max values are not what I expected

Issue #6 new
Former user created an issue

I have the following test case:

public class HdrHistogramRestOnSnapshotReservoirPlay {

public static void main(String[] args) {
    HdrHistogramResetOnSnapshotReservoir reservior = new HdrHistogramResetOnSnapshotReservoir();
    com.codahale.metrics.Histogram histo = new com.codahale.metrics.Histogram(reservior);

    histo.update(10000);
    Snapshot s = histo.getSnapshot();
    System.out.println(s.getMin());
    System.out.println(s.getMax());
}

}

Which outputs:

9984 10047

Why isn't min and max 10000?

Comments (1)

  1. Marshall Pierce repo owner

    Though it may be surprising, this is actually correct behavior. The point of the HdrHistogram data structure is to have limited precision loss that scales with the sample size so that the data structure stays compact even when holding a huge range of values. If you chose to use a histogram with different parameters that used more space (and therefore had higher precision), you would see a min and max that were closer to your single sample. See https://github.com/HdrHistogram/HdrHistogram/issues/105 for another user with similar questions.

  2. Log in to comment