@Override public synchronized void add(final DoubleHistogram fromHistogram) throws ArrayIndexOutOfBoundsException { // Synchronize add(). Avoid deadlocks by synchronizing in order of construction identity count. if (integerValuesHistogram.identity < fromHistogram.integerValuesHistogram.identity) { synchronized (this) { synchronized (fromHistogram) { super.add(fromHistogram); } } } else { synchronized (fromHistogram) { synchronized (this) { super.add(fromHistogram); } } } }
/** * Copy this histogram into the target histogram, overwriting it's contents. * * @param targetHistogram the histogram to copy into */ public void copyInto(final DoubleHistogram targetHistogram) { targetHistogram.reset(); targetHistogram.add(this); targetHistogram.setStartTimeStamp(integerValuesHistogram.startTimeStampMsec); targetHistogram.setEndTimeStamp(integerValuesHistogram.endTimeStampMsec); }
throw new IllegalStateException("Encountered a DoubleHistogram line in a log of Histograms."); accumulatedDoubleHistogram.add((DoubleHistogram) intervalHistogram); } else { if (logUsesDoubleHistograms) { ((DoubleHistogram) movingWindowSumHistogram).add((DoubleHistogram) intervalHistogram); } else { ((Histogram) movingWindowSumHistogram).add((Histogram) intervalHistogram);
@Override public AbstractInternalHDRPercentiles doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { DoubleHistogram merged = null; for (InternalAggregation aggregation : aggregations) { final AbstractInternalHDRPercentiles percentiles = (AbstractInternalHDRPercentiles) aggregation; if (merged == null) { merged = new DoubleHistogram(percentiles.state); merged.setAutoResize(true); } merged.add(percentiles.state); } return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetaData()); }
@Override public void merge(final Mergeable mergeable) { if (mergeable instanceof FeatureNumericHistogramStatistics) { positiveHistogram.add(((FeatureNumericHistogramStatistics) mergeable).positiveHistogram); if (((FeatureNumericHistogramStatistics) mergeable).negativeHistogram != null) { if (negativeHistogram != null) { negativeHistogram.add(((FeatureNumericHistogramStatistics) mergeable).negativeHistogram); } else { negativeHistogram = ((FeatureNumericHistogramStatistics) mergeable).negativeHistogram; } } } }
@Override public synchronized void add(final DoubleHistogram fromHistogram) throws ArrayIndexOutOfBoundsException { // Synchronize add(). Avoid deadlocks by synchronizing in order of construction identity count. if (integerValuesHistogram.identity < fromHistogram.integerValuesHistogram.identity) { synchronized (this) { synchronized (fromHistogram) { super.add(fromHistogram); } } } else { synchronized (fromHistogram) { synchronized (this) { super.add(fromHistogram); } } } }
void merge(UntypedMetric other, boolean otherIsNewer) throws IllegalArgumentException { if (outputFormat == AssumedType.NONE) { outputFormat = other.outputFormat; } if (outputFormat != other.outputFormat) { throw new IllegalArgumentException("Mismatching output formats: " + outputFormat + " and " + other.outputFormat + "."); } count += other.count; if (otherIsNewer) { current = other.current; } max = Math.max(other.max, max); min = Math.min(other.min, min); sum += other.sum; if (histogram != null) { // some config scenarios may lead to differing histogram settings, // so doing this defensively if (other.histogram != null) { try { histogram.add(other.histogram); } catch (ArrayIndexOutOfBoundsException e) { log.log(LogLevel.WARNING, "Had trouble merging histograms: " + e.getMessage()); } } } }
private void accumulate() { currentHistogram().getIntervalHistogramInto(intervalHistogram); accumulatedHistogram.add(intervalHistogram); }
/** * Copy this histogram into the target histogram, overwriting it's contents. * * @param targetHistogram the histogram to copy into */ public void copyInto(final DoubleHistogram targetHistogram) { targetHistogram.reset(); targetHistogram.add(this); targetHistogram.setStartTimeStamp(integerValuesHistogram.startTimeStampMsec); targetHistogram.setEndTimeStamp(integerValuesHistogram.endTimeStampMsec); }
@Override public AbstractInternalHDRPercentiles doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { DoubleHistogram merged = null; for (InternalAggregation aggregation : aggregations) { final AbstractInternalHDRPercentiles percentiles = (AbstractInternalHDRPercentiles) aggregation; if (merged == null) { merged = new DoubleHistogram(percentiles.state); merged.setAutoResize(true); } merged.add(percentiles.state); } return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetaData()); }
@Override public AbstractInternalHDRPercentiles doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { DoubleHistogram merged = null; for (InternalAggregation aggregation : aggregations) { final AbstractInternalHDRPercentiles percentiles = (AbstractInternalHDRPercentiles) aggregation; if (merged == null) { merged = new DoubleHistogram(percentiles.state); merged.setAutoResize(true); } merged.add(percentiles.state); } return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetaData()); }
@Override public AbstractInternalHDRPercentiles doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { DoubleHistogram merged = null; for (InternalAggregation aggregation : aggregations) { final AbstractInternalHDRPercentiles percentiles = (AbstractInternalHDRPercentiles) aggregation; if (merged == null) { merged = new DoubleHistogram(percentiles.state); merged.setAutoResize(true); } merged.add(percentiles.state); } return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetaData()); }
@Override public AbstractInternalHDRPercentiles doReduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { DoubleHistogram merged = null; for (InternalAggregation aggregation : aggregations) { final AbstractInternalHDRPercentiles percentiles = (AbstractInternalHDRPercentiles) aggregation; if (merged == null) { merged = new DoubleHistogram(percentiles.state); merged.setAutoResize(true); } merged.add(percentiles.state); } return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetaData()); }
throw new IllegalStateException("Encountered a DoubleHistogram line in a log of Histograms."); accumulatedDoubleHistogram.add((DoubleHistogram) intervalHistogram); } else { if (accumulatedRegularHistogram == null) {
throw new IllegalStateException("Encountered a DoubleHistogram line in a log of Histograms."); accumulatedDoubleHistogram.add((DoubleHistogram) intervalHistogram); } else { if (logUsesDoubleHistograms) { ((DoubleHistogram) movingWindowSumHistogram).add((DoubleHistogram) intervalHistogram); } else { ((Histogram) movingWindowSumHistogram).add((Histogram) intervalHistogram);