/** * Returns a snapshot of the decaying values in this reservoir. * * Non-decaying reservoir will not be included in the snapshot. * * @return the snapshot */ public Snapshot getSnapshot() { rescaleIfNeeded(); lockForRegularUsage(); try { return new EstimatedHistogramReservoirSnapshot(this); } finally { unlockForRegularUsage(); } }
/** * Returns a snapshot of the decaying values in this reservoir. * * Non-decaying reservoir will not be included in the snapshot. * * @return the snapshot */ public Snapshot getSnapshot() { rescaleIfNeeded(); lockForRegularUsage(); try { return new EstimatedHistogramReservoirSnapshot(this); } finally { unlockForRegularUsage(); } }
/** * Returns a snapshot of the decaying values in this reservoir. * * Non-decaying reservoir will not be included in the snapshot. * * @return the snapshot */ public Snapshot getSnapshot() { rescaleIfNeeded(); lockForRegularUsage(); try { return new EstimatedHistogramReservoirSnapshot(this); } finally { unlockForRegularUsage(); } }
/** * Returns a snapshot of the decaying values in this reservoir. * * Non-decaying reservoir will not be included in the snapshot. * * @return the snapshot */ public Snapshot getSnapshot() { rescaleIfNeeded(); lockForRegularUsage(); try { return new EstimatedHistogramReservoirSnapshot(this); } finally { unlockForRegularUsage(); } }
/** * Increments the count of the bucket closest to n, rounding UP. * * @param value the data point to add to the histogram */ public void update(long value) { long now = clock.getTime(); rescaleIfNeeded(now); int index = Arrays.binarySearch(bucketOffsets, value); if (index < 0) { // inexact match, take the first bucket higher than n index = -index - 1; } // else exact match; we're good lockForRegularUsage(); try { decayingBuckets.getAndAdd(index, Math.round(forwardDecayWeight(now))); } finally { unlockForRegularUsage(); } buckets.getAndIncrement(index); }
/** * Increments the count of the bucket closest to n, rounding UP. * * @param value the data point to add to the histogram */ public void update(long value) { long now = clock.getTime(); rescaleIfNeeded(now); int index = Arrays.binarySearch(bucketOffsets, value); if (index < 0) { // inexact match, take the first bucket higher than n index = -index - 1; } // else exact match; we're good lockForRegularUsage(); try { decayingBuckets.getAndAdd(index, Math.round(forwardDecayWeight(now))); } finally { unlockForRegularUsage(); } buckets.getAndIncrement(index); }
/** * Increments the count of the bucket closest to n, rounding UP. * * @param value the data point to add to the histogram */ public void update(long value) { long now = clock.getTime(); rescaleIfNeeded(now); int index = Arrays.binarySearch(bucketOffsets, value); if (index < 0) { // inexact match, take the first bucket higher than n index = -index - 1; } // else exact match; we're good lockForRegularUsage(); try { decayingBuckets.getAndAdd(index, Math.round(forwardDecayWeight(now))); } finally { unlockForRegularUsage(); } buckets.getAndIncrement(index); }
/** * Increments the count of the bucket closest to n, rounding UP. * * @param value the data point to add to the histogram */ public void update(long value) { long now = clock.getTime(); rescaleIfNeeded(now); int index = Arrays.binarySearch(bucketOffsets, value); if (index < 0) { // inexact match, take the first bucket higher than n index = -index - 1; } // else exact match; we're good lockForRegularUsage(); try { decayingBuckets.getAndAdd(index, Math.round(forwardDecayWeight(now))); } finally { unlockForRegularUsage(); } buckets.getAndIncrement(index); }