@Test public void testVariableRateAtomicLong() throws Exception { AtomicLong value = new AtomicLong(); Rate<AtomicLong> rate = Rate.of("test", value).withTicker(ticker).build(); ticker.waitNanos(ONE_SEC); value.set(10); assertEquals(0d, rate.sample(), EPSILON); ticker.waitNanos(ONE_SEC); value.set(20); assertEquals(10d, rate.sample(), EPSILON); ticker.waitNanos(ONE_SEC); value.set(50); assertEquals(30d, rate.sample(), EPSILON); ticker.waitNanos(ONE_SEC); value.set(100); assertEquals(50d, rate.sample(), EPSILON); control.replay(); }
public static <T extends Number> Builder<T> of(Stat<T> input) { return new Builder<T>(input); }
Rate extends SampledStat<Double> { public static <T extends Number> Builder<T> of(Stat<T> input) { return new Builder<T>(input); } }
Rate extends SampledStat<Double> { public static <T extends Number> Builder<T> of(Stat<T> input) { return new Builder<T>(input); } private  Rate(String name, Supplier<T> inputAccessor, int windowSize, double scaleFactor,
      Ticker ticker); }
Rate extends SampledStat<Double> { public static <T extends Number> Builder<T> of(Stat<T> input) { return new Builder<T>(input); } private  Rate(String name, Supplier<T> inputAccessor, int windowSize, double scaleFactor,
      Ticker ticker); static Builder<T> of(Stat<T> input); static Builder<Long> of(String name, Supplier<Long> input); static Builder<AtomicInteger> of(String name, AtomicInteger input); static Builder<AtomicLong> of(String name, AtomicLong input); @Override Double doSample(); }
Rate extends SampledStat<Double> { public static <T extends Number> Builder<T> of(Stat<T> input) { return new Builder<T>(input); } private  Rate(String name, Supplier<T> inputAccessor, int windowSize, double scaleFactor,
      Ticker ticker); static Builder<T> of(Stat<T> input); static Builder<Long> of(String name, Supplier<Long> input); static Builder<AtomicInteger> of(String name, AtomicInteger input); static Builder<AtomicLong> of(String name, AtomicLong input); @Override Double doSample();  }