@Test public void testShuffledSteps() { List<Integer> values = Lists.newArrayList(); for (int i = 0; i < 1000; i++) { for (int j = 0; j < 10; j++) { values.add(i); } } values.add(2000); Collections.shuffle(values); for (int sample : values) { percentiles.record(sample); } checkPercentiles(percentiles, 0, 100, 500, 900, 990, 999, 999, 2000); checkValuesAreFlushed(percentiles); }
public void record(T value) { if (sampler == null || sampler.select()) { synchronized (samples) { samples.addLast(value); while (samples.size() > MAX_BUFFER_SIZE) samples.removeFirst(); } } }
Percentile { public void record(T value) { if (sampler == null || sampler.select()) { synchronized (samples) { samples.addLast(value); while (samples.size() > MAX_BUFFER_SIZE) samples.removeFirst(); } } } }
Percentile { public void record(T value) { if (sampler == null || sampler.select()) { synchronized (samples) { samples.addLast(value); while (samples.size() > MAX_BUFFER_SIZE) samples.removeFirst(); } } } Percentile(String name, float samplePercent, double... percentiles);  Percentile(String name, Sampler sampler, double... percentiles);  Percentile(String name, int numSampleWindows,
      @Nullable Sampler sampler, double... percentiles); }
Percentile { public void record(T value) { if (sampler == null || sampler.select()) { synchronized (samples) { samples.addLast(value); while (samples.size() > MAX_BUFFER_SIZE) samples.removeFirst(); } } } Percentile(String name, float samplePercent, double... percentiles);  Percentile(String name, Sampler sampler, double... percentiles);  Percentile(String name, int numSampleWindows,
      @Nullable Sampler sampler, double... percentiles); Map<Double, ? extends Stat<?>> getPercentiles(); void record(T value); }
Percentile { public void record(T value) { if (sampler == null || sampler.select()) { synchronized (samples) { samples.addLast(value); while (samples.size() > MAX_BUFFER_SIZE) samples.removeFirst(); } } } Percentile(String name, float samplePercent, double... percentiles);  Percentile(String name, Sampler sampler, double... percentiles);  Percentile(String name, int numSampleWindows,
      @Nullable Sampler sampler, double... percentiles); Map<Double, ? extends Stat<?>> getPercentiles(); void record(T value);  }