@Override public void run() { double report = -1; try { report = getIOWait(); } catch (IOException e) { // ignore; if (Utils.isUnix()) logger.warn("Couldn't read /proc/stats"); } if (report == -1d) report = compactionSeverity.sum(); if (!Gossiper.instance.isEnabled()) return; report += manualSeverity.sum(); // add manual severity setting. VersionedValue updated = P2pServer.valueFactory.severity(report); Gossiper.instance.addLocalApplicationState(ApplicationState.SEVERITY, updated); } }
@Override public void accept(ProgressEvent progressEvent) { Allocation allocation = progressEvent.getAllocation(); long progressUnits = progressEvent.getUnits(); double allocationFraction = allocation.getFractionOfRoot(); if (progressUnits != 0) { progress.add(progressUnits * allocationFraction); } if (completionTracker.updateProgress(allocation, progressUnits)) { // Note: Could produce false positives. updateNotifier.accept( new Update(progress.sum(), completionTracker.getUnfinishedAllocations())); } } }
@Override public double getValue() { synchronized (this) { return value.sum(); } }
@Override public double get() { synchronized (this) { return value.sum(); } } }
public double sum() { return sum.sum(); } }
public double sum() { return sum.sum(); } }
@Override public double getSum() { return sum.sum(); }
@Override protected RFuture<Double> addAndGetAsync() { return atomicDouble.getAndAddAsync(counter.sum()); }
DoubleAdder adder = new DoubleAdder(); stream.forEach(e -> adder.add(e.getKey().getExitValue() * e.getValue())); System.out.println(adder.sum());
@Override public void decrement(double amount) { synchronized (this) { value.add(-amount); updateHistogram(value.sum()); } }
@Override public void increment(double amount) { synchronized (this) { value.add(amount); updateHistogram(value.sum()); } }
@Override public void accept(ProgressEvent progressEvent) { Allocation allocation = progressEvent.getAllocation(); long progressUnits = progressEvent.getUnits(); double allocationFraction = allocation.getFractionOfRoot(); if (progressUnits != 0) { progress.add(progressUnits * allocationFraction); } if (completionTracker.updateProgress(allocation, progressUnits)) { // Note: Could produce false positives. updateNotifier.accept( new Update(progress.sum(), completionTracker.getUnfinishedAllocations())); } } }
@Override public void accept(ProgressEvent progressEvent) { Allocation allocation = progressEvent.getAllocation(); long progressUnits = progressEvent.getUnits(); double allocationFraction = allocation.getFractionOfRoot(); if (progressUnits != 0) { progress.add(progressUnits * allocationFraction); } if (completionTracker.updateProgress(allocation, progressUnits)) { // Note: Could produce false positives. updateNotifier.accept( new Update(progress.sum(), completionTracker.getUnfinishedAllocations())); } } }
@Override public Stream<MetricFamilySamples.Sample> collect() { Stream.Builder<MetricFamilySamples.Sample> samples = Stream.builder(); if (quantiles != null) { for (Double q : quantiles.monitored()) { List<String> quantileValues = new LinkedList<>(tagValues); quantileValues.add(Collector.doubleToGoString(q)); samples.add(new MetricFamilySamples.Sample(name, quantileKeys, quantileValues, quantiles.get(q))); } } if (histogram != null) { for (Bucket<?> b : histogram.getBuckets()) { List<String> histogramValues = new LinkedList<>(tagValues); histogramValues.add(b.getTag(bucket -> bucket instanceof Double ? Collector.doubleToGoString((Double) bucket) : bucket.toString())); samples.add(new MetricFamilySamples.Sample(name + "_bucket", histogramKeys, histogramValues, b.getValue())); } } samples.add(new MetricFamilySamples.Sample(countName, tagKeys, tagValues, count.sum())); samples.add(new MetricFamilySamples.Sample(sumName, tagKeys, tagValues, sum.sum())); return samples.build(); }
@Override public Stream<MetricFamilySamples.Sample> collect() { Stream.Builder<MetricFamilySamples.Sample> samples = Stream.builder(); if (quantiles != null) { for (Double q : quantiles.monitored()) { List<String> quantileValues = new LinkedList<>(tagValues); quantileValues.add(Collector.doubleToGoString(q)); samples.add(new MetricFamilySamples.Sample(name, quantileKeys, quantileValues, quantiles.get(q))); } } if (histogram != null) { for (Bucket<?> b : histogram.getBuckets()) { List<String> histogramValues = new LinkedList<>(tagValues); histogramValues.add(b.getTag(bucket -> bucket instanceof Double ? Collector.doubleToGoString((Double) bucket) : bucket.toString())); samples.add(new MetricFamilySamples.Sample(name + "_bucket", histogramKeys, histogramValues, b.getValue())); } } samples.add(new MetricFamilySamples.Sample(countName, tagKeys, tagValues, count.sum())); samples.add(new MetricFamilySamples.Sample(sumName, tagKeys, tagValues, sum.sum())); return samples.build(); }