use of com.codahale.metrics.Snapshot in project engineblock by engineblock.
the class TestHistoTypes method summary.
private void summary(long min, long max, Snapshot... snapshots) {
for (int i = 0; i <= 100; i++) {
double pct = (double) i / 100.0D;
double expectedValue = pct * max;
System.out.format("% 3d %%p is % 11d : ", (long) (pct * 100), (long) expectedValue);
for (Snapshot snapshot : snapshots) {
System.out.format("% 10d ", (long) snapshot.getValue(pct));
}
System.out.print("\n");
}
}
use of com.codahale.metrics.Snapshot in project oxCore by GluuFederation.
the class LdapEntryReporter method builTimerEntries.
private List<MetricEntry> builTimerEntries(SortedMap<String, Timer> timers, Set<MetricType> registeredMetricTypes) {
List<MetricEntry> result = new ArrayList<MetricEntry>();
for (MetricType metricType : registeredMetricTypes) {
Timer timer = timers.get(metricType.getValue());
if (timer != null) {
Snapshot snapshot = timer.getSnapshot();
TimerMetricData timerMetricData = new TimerMetricData(timer.getCount(), convertRate(timer.getMeanRate()), convertRate(timer.getOneMinuteRate()), convertRate(timer.getFiveMinuteRate()), convertRate(timer.getFifteenMinuteRate()), getRateUnit(), convertDuration(snapshot.getMin()), convertDuration(snapshot.getMax()), convertDuration(snapshot.getMean()), convertDuration(snapshot.getStdDev()), convertDuration(snapshot.getMedian()), convertDuration(snapshot.get75thPercentile()), convertDuration(snapshot.get95thPercentile()), convertDuration(snapshot.get98thPercentile()), convertDuration(snapshot.get99thPercentile()), convertDuration(snapshot.get999thPercentile()), getDurationUnit());
TimerMetricEntry timerMetricEntry = new TimerMetricEntry();
timerMetricEntry.setMetricData(timerMetricData);
timerMetricEntry.setMetricType(metricType);
result.add(timerMetricEntry);
}
}
return result;
}
use of com.codahale.metrics.Snapshot in project sling by apache.
the class MetricWebConsolePlugin method addHistogramDetails.
private void addHistogramDetails(PrintWriter pw, SortedMap<String, Histogram> histograms) {
if (histograms.isEmpty()) {
return;
}
pw.println("<br>");
pw.println("<div class='table'>");
pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>Histograms</div>");
pw.println("<table class='nicetable' id='data-histograms'>");
pw.println("<thead>");
pw.println("<tr>");
pw.println("<th class='header'>Name</th>");
pw.println("<th class='header'>Count</th>");
pw.println("<th class='header'>50%</th>");
pw.println("<th class='header'>Min</th>");
pw.println("<th class='header'>Max</th>");
pw.println("<th class='header'>Mean</th>");
pw.println("<th class='header'>StdDev</th>");
pw.println("<th class='header'>75%</th>");
pw.println("<th class='header'>95%</th>");
pw.println("<th class='header'>98%</th>");
pw.println("<th class='header'>99%</th>");
pw.println("<th class='header'>999%</th>");
pw.println("<th>Duration Unit</th>");
pw.println("</tr>");
pw.println("</thead>");
pw.println("<tbody>");
String rowClass = "odd";
for (Map.Entry<String, Histogram> e : histograms.entrySet()) {
Histogram h = e.getValue();
Snapshot s = h.getSnapshot();
String name = e.getKey();
double durationFactor = 1.0 / timeUnit.durationFor(name).toNanos(1);
String durationUnit = timeUnit.durationFor(name).toString().toLowerCase(Locale.US);
pw.printf("<tr class='%s ui-state-default'>%n", rowClass);
pw.printf("<td>%s</td>", name);
pw.printf("<td>%d</td>", h.getCount());
pw.printf("<td>%f</td>", s.getMedian() * durationFactor);
pw.printf("<td>%f</td>", s.getMin() * durationFactor);
pw.printf("<td>%f</td>", s.getMax() * durationFactor);
pw.printf("<td>%f</td>", s.getMean() * durationFactor);
pw.printf("<td>%f</td>", s.getStdDev() * durationFactor);
pw.printf("<td>%f</td>", s.get75thPercentile() * durationFactor);
pw.printf("<td>%f</td>", s.get95thPercentile() * durationFactor);
pw.printf("<td>%f</td>", s.get98thPercentile() * durationFactor);
pw.printf("<td>%f</td>", s.get99thPercentile() * durationFactor);
pw.printf("<td>%f</td>", s.get999thPercentile() * durationFactor);
pw.printf("<td>%s</td>", durationUnit);
pw.println("</tr>");
rowClass = "odd".equals(rowClass) ? "even" : "odd";
}
pw.println("</tbody>");
pw.println("</table>");
pw.println("</div>");
}
use of com.codahale.metrics.Snapshot in project sling by apache.
the class JSONReporter method printTimer.
private void printTimer(Map.Entry<String, Timer> e) throws IOException {
json.key(e.getKey()).object();
Timer timer = e.getValue();
Snapshot snapshot = timer.getSnapshot();
json.key("count").value(timer.getCount());
json.key("max").value(snapshot.getMax() * durationFactor);
json.key("mean").value(snapshot.getMean() * durationFactor);
json.key("min").value(snapshot.getMin() * durationFactor);
json.key("p50").value(snapshot.getMedian() * durationFactor);
json.key("p75").value(snapshot.get75thPercentile() * durationFactor);
json.key("p95").value(snapshot.get95thPercentile() * durationFactor);
json.key("p98").value(snapshot.get98thPercentile() * durationFactor);
json.key("p99").value(snapshot.get99thPercentile() * durationFactor);
json.key("p999").value(snapshot.get999thPercentile() * durationFactor);
json.key("stddev").value(snapshot.getStdDev() * durationFactor);
json.key("m1_rate").value(timer.getOneMinuteRate() * rateFactor);
json.key("m5_rate").value(timer.getFiveMinuteRate() * rateFactor);
json.key("m15_rate").value(timer.getFifteenMinuteRate() * rateFactor);
json.key("mean_rate").value(timer.getMeanRate() * rateFactor);
json.key("duration_units").value(durationUnit);
json.key("rate_units").value(rateUnit);
json.endObject();
}
use of com.codahale.metrics.Snapshot in project sling by apache.
the class JSONReporter method printHistogram.
private void printHistogram(Map.Entry<String, Histogram> e) throws IOException {
json.key(e.getKey()).object();
json.key("count").value(e.getValue().getCount());
Snapshot snapshot = e.getValue().getSnapshot();
json.key("max").value(snapshot.getMax());
json.key("mean").value(snapshot.getMean());
json.key("min").value(snapshot.getMin());
json.key("p50").value(snapshot.getMedian());
json.key("p75").value(snapshot.get75thPercentile());
json.key("p95").value(snapshot.get95thPercentile());
json.key("p98").value(snapshot.get98thPercentile());
json.key("p99").value(snapshot.get99thPercentile());
json.key("p999").value(snapshot.get999thPercentile());
json.key("stddev").value(snapshot.getStdDev());
json.endObject();
}
Aggregations