@Test public void testMultipleSampleWindows() { Percentile<Integer> mypercentile = new Percentile<Integer>("test", 2, null, PERCENTILES); for (int i = 0; i < 10000; i++) { mypercentile.record(i); } mypercentile.record(90000); checkPercentiles(mypercentile, 0, 1000, 5000, 9000, 9900, 9990, 9999, 90000); for (int i = 10000; i < 20000; i++) { mypercentile.record(i); } checkPercentiles(mypercentile, 0, 2000, 10000, 18000, 19800, 19980, 19998, 90000); for (int i = 20000; i < 30000; i++) { mypercentile.record(i); } mypercentile.record(90000); checkPercentiles(mypercentile, 10000, 12000, 20000, 28000, 29800, 29980, 29998, 90000); }
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);  }