Maven:
<dependency>
<groupId>org.hdrhistogram</groupId>
<artifactId>HdrHistogram</artifactId>
<version>2.1.11</version>
</dependency>
Gradle:
groovy
implementation 'org.hdrhistogram:HdrHistogram:2.1.11'
Histogram histogram = new Histogram(1, 100000000, 2);
histogram.recordValue(1234);
histogram.recordValue(5678);
// ...
- ...
System.out.println(histogram.outputPercentileDistribution());
import org.hdrhistogram.Histogram;
public class HdrHistogramExample {
public static void main(String[] args) {
Histogram histogram = new Histogram(1, 100000000, 2);
histogram.recordValue(1234);
histogram.recordValue(5678);
System.out.println("Min: " + histogram.getMinNonZeroValue());
System.out.println("Max: " + histogram.getMaxValue());
System.out.println("Mean: " + histogram.getMean());
System.out.println("99.9th Percentile: " + histogram.getValueAtPercentile(99.9));
System.out.println("Total Count: " + histogram.getTotalCount());
System.out.println("Range: " + histogram.getRange());
System.out.println("Std Deviation: " + histogram.getStdDeviation());
System.out.println(histogram.outputPercentileDistribution());
}
}