@Test public void testEqualsCount() throws Exception { BucketTimer c1 = newInstance("foo"); BucketTimer c2 = newInstance("foo"); assertEquals(c1, c2); c1.record(42); assertNotEquals(c1, c2); c2.record(42); assertEquals(c1, c2); c1.record(11); assertNotEquals(c1, c2); c2.record(11); assertEquals(c1, c2); }
@Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); }
BucketTimer extends AbstractMonitor<Long> implements Timer, CompositeMonitor<Long>, SpectatorMonitor { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); } }
BucketTimer extends AbstractMonitor<Long> implements Timer, CompositeMonitor<Long>, SpectatorMonitor { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); } BucketTimer(MonitorConfig config, BucketConfig bucketConfig);  BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit);   BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit, Clock clock); }
BucketTimer extends AbstractMonitor<Long> implements Timer, CompositeMonitor<Long>, SpectatorMonitor { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); } BucketTimer(MonitorConfig config, BucketConfig bucketConfig);  BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit);   BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit, Clock clock); @Override void initializeSpectator(TagList tags); @Override List<Monitor<?>> getMonitors(); @Override Stopwatch start(); @Override TimeUnit getTimeUnit(); @Override void record(long duration); @Override void record(long duration, TimeUnit unit); @Override Long getValue(int pollerIndex); Long getTotalTime(); Long getCount(int pollerIndex); Long getMin(int pollerIndex); Long getMax(int pollerIndex); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
BucketTimer extends AbstractMonitor<Long> implements Timer, CompositeMonitor<Long>, SpectatorMonitor { @Override public void record(long duration) { totalTime.increment(duration); min.update(duration); max.update(duration); final long[] buckets = bucketConfig.getBuckets(); final long bucketDuration = bucketConfig.getTimeUnit().convert(duration, timeUnit); for (int i = 0; i < buckets.length; i++) { if (bucketDuration <= buckets[i]) { bucketCount[i].increment(); return; } } overflowCount.increment(); } BucketTimer(MonitorConfig config, BucketConfig bucketConfig);  BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit);   BucketTimer(MonitorConfig config, BucketConfig bucketConfig, TimeUnit unit, Clock clock); @Override void initializeSpectator(TagList tags); @Override List<Monitor<?>> getMonitors(); @Override Stopwatch start(); @Override TimeUnit getTimeUnit(); @Override void record(long duration); @Override void record(long duration, TimeUnit unit); @Override Long getValue(int pollerIndex); Long getTotalTime(); Long getCount(int pollerIndex); Long getMin(int pollerIndex); Long getMax(int pollerIndex); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }