@Test public void doesNotAcceptNegativeValues() { assertThrows(IllegalArgumentException.class, () -> newHistogram(2, 2).recordValue(-1)); }
public synchronized void recordValue(long msValue) { checkArgument(msValue >= 0, "Recorded value must be a positive number."); long currentTime = clock.tickMillis(); purgeOldHistograms(currentTime); int bucket = bucketFromTime(currentTime); window[bucket].recordValue(msValue); lastUpdateTime = currentTime; }
SlidingWindowHistogram { public synchronized void recordValue(long msValue) { checkArgument(msValue >= 0, "Recorded value must be a positive number."); long currentTime = clock.tickMillis(); purgeOldHistograms(currentTime); int bucket = bucketFromTime(currentTime); window[bucket].recordValue(msValue); lastUpdateTime = currentTime; } }
SlidingWindowHistogram { public synchronized void recordValue(long msValue) { checkArgument(msValue >= 0, "Recorded value must be a positive number."); long currentTime = clock.tickMillis(); purgeOldHistograms(currentTime); int bucket = bucketFromTime(currentTime); window[bucket].recordValue(msValue); lastUpdateTime = currentTime; } private  SlidingWindowHistogram(Builder builder); }
SlidingWindowHistogram { public synchronized void recordValue(long msValue) { checkArgument(msValue >= 0, "Recorded value must be a positive number."); long currentTime = clock.tickMillis(); purgeOldHistograms(currentTime); int bucket = bucketFromTime(currentTime); window[bucket].recordValue(msValue); lastUpdateTime = currentTime; } private  SlidingWindowHistogram(Builder builder); synchronized void recordValue(long msValue); synchronized double getMean(); synchronized double getValueAtPercentile(double percentile); synchronized double getStdDeviation(); synchronized Histogram copy(); int windowSize(); long timeIntervalMs(); }
SlidingWindowHistogram { public synchronized void recordValue(long msValue) { checkArgument(msValue >= 0, "Recorded value must be a positive number."); long currentTime = clock.tickMillis(); purgeOldHistograms(currentTime); int bucket = bucketFromTime(currentTime); window[bucket].recordValue(msValue); lastUpdateTime = currentTime; } private  SlidingWindowHistogram(Builder builder); synchronized void recordValue(long msValue); synchronized double getMean(); synchronized double getValueAtPercentile(double percentile); synchronized double getStdDeviation(); synchronized Histogram copy(); int windowSize(); long timeIntervalMs();  }