use of org.HdrHistogram.AtomicHistogram in project LatencyUtils by LatencyUtils.
the class LatencyStats method swapRecordingHistograms.
private void swapRecordingHistograms() {
final AtomicHistogram tempHistogram = inactiveRawDataHistogram;
inactiveRawDataHistogram = activeRecordingHistogram;
activeRecordingHistogram = tempHistogram;
}
use of org.HdrHistogram.AtomicHistogram in project graylog2-server by Graylog2.
the class HdrHistogram method getSnapshot.
@Override
public Snapshot getSnapshot() {
final AtomicHistogram copy = hdrHistogram.copy();
return new Snapshot() {
@Override
public double getValue(double quantile) {
return copy.getValueAtPercentile(quantile * 100);
}
@Override
public long[] getValues() {
return new long[0];
}
@Override
public int size() {
return 0;
}
@Override
public long getMax() {
return copy.getMaxValue();
}
@Override
public double getMean() {
final double mean = copy.getMean();
return Double.isNaN(mean) ? 0 : mean;
}
@Override
public long getMin() {
final long minValue = copy.getMinValue();
return minValue == Long.MAX_VALUE ? 0 : minValue;
}
@Override
public double getStdDev() {
final double stdDeviation = copy.getStdDeviation();
return Double.isNaN(stdDeviation) ? 0 : stdDeviation;
}
@Override
public void dump(OutputStream output) {
final PrintStream printStream;
try {
printStream = new PrintStream(output, false, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
copy.outputPercentileDistribution(printStream, 1d);
}
};
}
Aggregations