@Override public long[] getValues() { return snapshot.getValues(); }
@Override public Double getValue() { Snapshot snapshot = processedDurationHistogram.getSnapshot(); double meanProcessTime = snapshot.getMean(); int numProcessed = snapshot.getValues().length; return (numProcessed * meanProcessTime) / timeUnit.toMillis(window); } }
/** * flush temp histogram data to all windows & assoc metrics. */ protected void doFlush() { long[] values = unFlushed.getSnapshot().getValues(); for (JHistogram histogram : histogramMap.values()) { for (long val : values) { histogram.update(val); } } if (MetricUtils.metricAccurateCal) { for (long val : values) { for (AsmMetric metric : this.assocMetrics) { metric.updateDirectly(val); } } } this.unFlushed = newHistogram(); }
private static Map<String, Object> snapshot(final Sampling sampling, final double durationFactor, final boolean showSamples) { Map<String, Object> result = new TreeMap<>(); final Snapshot snapshot = sampling.getSnapshot(); result.put("max", snapshot.getMax() * durationFactor); result.put("mean", snapshot.getMean() * durationFactor); result.put("min", snapshot.getMin() * durationFactor); result.put("p50", snapshot.getMedian() * durationFactor); result.put("p75", snapshot.get75thPercentile() * durationFactor); result.put("p95", snapshot.get95thPercentile() * durationFactor); result.put("p98", snapshot.get98thPercentile() * durationFactor); result.put("p99", snapshot.get99thPercentile() * durationFactor); result.put("p999", snapshot.get999thPercentile() * durationFactor); if (showSamples) { final long[] values = snapshot.getValues(); List<Double> scaledValues = new ArrayList<>(values.length); for (long value : values) { scaledValues.add(value * durationFactor); } result.put("values", scaledValues); } return result; }
snapshot.set_points(MetricUtils.longs2bytes(snapshot1.getValues()));
@VisibleForTesting Long getOutcomeCount(BackgroundCompactor.CompactionOutcome outcome) { if (outcome == BackgroundCompactor.CompactionOutcome.SHUTDOWN) { return shutdown ? 1L : 0L; } return Arrays.stream(reservoir.getSnapshot().getValues()) .filter(l -> l == outcome.ordinal()) .count(); }
private Long getOutcomeCount(SweepOutcome outcome) { if (outcome == SweepOutcome.SHUTDOWN) { return shutdown ? 1L : 0L; } if (outcome == SweepOutcome.FATAL) { return fatal ? 1L : 0L; } return Arrays.stream(reservoir.getSnapshot().getValues()) .filter(l -> l == outcome.ordinal()) .count(); }
public List<Double> dumpTimings(String hostname) throws UnknownHostException { InetAddress host = InetAddress.getByName(hostname); ArrayList<Double> timings = new ArrayList<Double>(); ExponentiallyDecayingReservoir sample = samples.get(host); if (sample != null) { for (double time: sample.getSnapshot().getValues()) timings.add(time); } return timings; }
@Override public long[] values() { return metric.getSnapshot().getValues(); } }
public List<Double> dumpTimings(String hostname) throws UnknownHostException { InetAddress host = InetAddress.getByName(hostname); ArrayList<Double> timings = new ArrayList<Double>(); ExponentiallyDecayingReservoir sample = samples.get(host); if (sample != null) { for (double time: sample.getSnapshot().getValues()) timings.add(time); } return timings; }
@Override public long[] values() { return metric.getSnapshot().getValues(); } }
@Override public long[] values() { return metric.getSnapshot().getValues(); }
@Override public long[] values() { return metric.getSnapshot().getValues(); }
@Override public long[] values() { return metric.getSnapshot().getValues(); } }
@Override public long[] values() { return metric.getSnapshot().getValues(); } }
@Override public long[] values() { return metric.getSnapshot().getValues(); }
public List<Double> dumpTimings(String hostname) throws UnknownHostException { InetAddress host = InetAddress.getByName(hostname); ArrayList<Double> timings = new ArrayList<Double>(); ExponentiallyDecayingReservoir sample = samples.get(host); if (sample != null) { for (double time: sample.getSnapshot().getValues()) timings.add(time); } return timings; }
public void mergeTo(MergeableTimer timer) { Histogram hist = this.histogram.getAndSet(new Histogram(new UniformReservoir())); for (long l : hist.getSnapshot().getValues()) timer.histogram.update(l); timer.meter.mark(count.getAndSet(0L)); }
private long getTimerValue(Timer timer) { long[] values = timer.getSnapshot().getValues(); // These get stored in nanoseconds but Cron is in milliseconds return TimeUnit.NANOSECONDS.toMillis(values[0]); }