@Override public double getQuantile(double quantile) { return snapshot.getValue(quantile); }
/** * Returns the value at the 75th percentile in the distribution. * * @return the value at the 75th percentile */ public double get75thPercentile() { return getValue(0.75); }
/** * Returns the value at the 98th percentile in the distribution. * * @return the value at the 98th percentile */ public double get98thPercentile() { return getValue(0.98); }
/** * Returns the median value in the distribution. * * @return the median value */ public double getMedian() { return getValue(0.5); }
/** * Returns the value at the 95th percentile in the distribution. * * @return the value at the 95th percentile */ public double get95thPercentile() { return getValue(0.95); }
/** * Returns the value at the 99th percentile in the distribution. * * @return the value at the 99th percentile */ public double get99thPercentile() { return getValue(0.99); }
/** * Returns the value at the 99.9th percentile in the distribution. * * @return the value at the 99.9th percentile */ public double get999thPercentile() { return getValue(0.999); }
public static boolean isFasterThanXPercentOfAllRequests(long executionTimeNanos, double percentileLimit, Timer timer) { boolean faster = true; if (percentileLimit > 0) { if (percentileLimit >= 1) { faster = false; } else { final double percentile = timer.getSnapshot().getValue(percentileLimit); if (executionTimeNanos < percentile) { faster = false; } } } return faster; }
/** @return a summary of {@code hist}. */ public static String getHistogramReport(final Histogram hist) { Snapshot sn = hist.getSnapshot(); return "mean=" + DOUBLE_FORMAT.format(sn.getMean()) + ", min=" + DOUBLE_FORMAT.format(sn.getMin()) + ", max=" + DOUBLE_FORMAT.format(sn.getMax()) + ", stdDev=" + DOUBLE_FORMAT.format(sn.getStdDev()) + ", 50th=" + DOUBLE_FORMAT.format(sn.getMedian()) + ", 75th=" + DOUBLE_FORMAT.format(sn.get75thPercentile()) + ", 95th=" + DOUBLE_FORMAT.format(sn.get95thPercentile()) + ", 99th=" + DOUBLE_FORMAT.format(sn.get99thPercentile()) + ", 99.9th=" + DOUBLE_FORMAT.format(sn.get999thPercentile()) + ", 99.99th=" + DOUBLE_FORMAT.format(sn.getValue(0.9999)) + ", 99.999th=" + DOUBLE_FORMAT.format(sn.getValue(0.99999)); }
/** @return pretty summary of {@code hist}. */ public static String getPrettyHistogramReport(final Histogram h) { Snapshot sn = h.getSnapshot(); return "Mean = " + DOUBLE_FORMAT.format(sn.getMean()) + "\n" + "Min = " + DOUBLE_FORMAT.format(sn.getMin()) + "\n" + "Max = " + DOUBLE_FORMAT.format(sn.getMax()) + "\n" + "StdDev = " + DOUBLE_FORMAT.format(sn.getStdDev()) + "\n" + "50th = " + DOUBLE_FORMAT.format(sn.getMedian()) + "\n" + "75th = " + DOUBLE_FORMAT.format(sn.get75thPercentile()) + "\n" + "95th = " + DOUBLE_FORMAT.format(sn.get95thPercentile()) + "\n" + "99th = " + DOUBLE_FORMAT.format(sn.get99thPercentile()) + "\n" + "99.9th = " + DOUBLE_FORMAT.format(sn.get999thPercentile()) + "\n" + "99.99th = " + DOUBLE_FORMAT.format(sn.getValue(0.9999)) + "\n" + "99.999th = " + DOUBLE_FORMAT.format(sn.getValue(0.99999)); } }
@Override double apply(Histogram hist) { return hist.getSnapshot().getValue(0.9999); } };
private String reportHistogramSnapshot(Snapshot snapshot) { return "min=" + snapshot.getMin() + "," + "max=" + snapshot.getMax() + "," + "mean=" + snapshot.getMean() + "," + "p50=" + snapshot.getMedian() + "," + "std=" + snapshot.getStdDev() + "," + "p25=" + snapshot.getValue(0.25) + "," + "p75=" + snapshot.get75thPercentile() + "," + "p95=" + snapshot.get95thPercentile() + "," + "p98=" + snapshot.get98thPercentile() + "," + "p99=" + snapshot.get99thPercentile() + "," + "p999=" + snapshot.get999thPercentile(); }
private String reportTimerSnapshot(Snapshot snapshot) { return "min=" + getDuration(snapshot.getMin()) + "," + "max=" + getDuration(snapshot.getMax()) + "," + "mean=" + getDuration(snapshot.getMean()) + "," + "p50=" + getDuration(snapshot.getMedian()) + "," + "std=" + getDuration(snapshot.getStdDev()) + "," + "p25=" + getDuration(snapshot.getValue(0.25)) + "," + "p75=" + getDuration(snapshot.get75thPercentile()) + "," + "p95=" + getDuration(snapshot.get95thPercentile()) + "," + "p98=" + getDuration(snapshot.get98thPercentile()) + "," + "p99=" + getDuration(snapshot.get99thPercentile()) + "," + "p999=" + getDuration(snapshot.get999thPercentile()); }
private void writeHistogramSnapshot(Snapshot snapshot, JsonGenerator jg) throws IOException { writeDoubleUnlessNaN(jg, "min", snapshot.getMin()); writeDoubleUnlessNaN(jg, "max", snapshot.getMax()); writeDoubleUnlessNaN(jg, "mean", snapshot.getMean()); writeDoubleUnlessNaN(jg, "p50", snapshot.getMedian()); writeDoubleUnlessNaN(jg, "std", snapshot.getStdDev()); writeDoubleUnlessNaN(jg, "p25", snapshot.getValue(0.25)); writeDoubleUnlessNaN(jg, "p75", snapshot.get75thPercentile()); writeDoubleUnlessNaN(jg, "p95", snapshot.get95thPercentile()); writeDoubleUnlessNaN(jg, "p98", snapshot.get98thPercentile()); writeDoubleUnlessNaN(jg, "p99", snapshot.get99thPercentile()); writeDoubleUnlessNaN(jg, "p999", snapshot.get999thPercentile()); }
private void writeTimerSnapshot(Snapshot snapshot, JsonGenerator jg) throws IOException { writeDoubleUnlessNaN(jg, "min", convertDuration(snapshot.getMin())); writeDoubleUnlessNaN(jg, "max", convertDuration(snapshot.getMax())); writeDoubleUnlessNaN(jg, "mean", convertDuration(snapshot.getMean())); writeDoubleUnlessNaN(jg, "p50", convertDuration(snapshot.getMedian())); writeDoubleUnlessNaN(jg, "std", convertDuration(snapshot.getStdDev())); writeDoubleUnlessNaN(jg, "p25", convertDuration(snapshot.getValue(0.25))); writeDoubleUnlessNaN(jg, "p75", convertDuration(snapshot.get75thPercentile())); writeDoubleUnlessNaN(jg, "p95", convertDuration(snapshot.get95thPercentile())); writeDoubleUnlessNaN(jg, "p98", convertDuration(snapshot.get98thPercentile())); writeDoubleUnlessNaN(jg, "p99", convertDuration(snapshot.get99thPercentile())); writeDoubleUnlessNaN(jg, "p999", convertDuration(snapshot.get999thPercentile())); }
/** * Returns the value at the 99.9th percentile in the distribution. * * @return the value at the 99.9th percentile */ public double get999thPercentile() { return getValue(0.999); }
/** * Returns the median value in the distribution. * * @return the median value */ public double getMedian() { return getValue(0.5); }
/** * Returns the value at the 75th percentile in the distribution. * * @return the value at the 75th percentile */ public double get75thPercentile() { return getValue(0.75); }
/** * Returns the value at the 98th percentile in the distribution. * * @return the value at the 98th percentile */ public double get98thPercentile() { return getValue(0.98); }
private Comparable[] printFileSizeHistogram(String commitTime, Snapshot s) { return new Comparable[]{commitTime, s.getMin(), s.getValue(0.1), s.getMedian(), s.getMean(), s.get95thPercentile(), s.getMax(), s.size(), s.getStdDev()}; }