예제 #1
0
 // Before fix this would throw an ArrayIndexOutOfBoundException
 @Test
 public void testCountOverflow() throws Exception {
   StatsBuffer buffer = new StatsBuffer(SIZE, PERCENTILES);
   setCount(buffer, Integer.MAX_VALUE);
   buffer.record(1);
   buffer.record(2);
 }
예제 #2
0
 StatsBuffer getWithWrap() {
   StatsBuffer buffer = new StatsBuffer(SIZE, PERCENTILES);
   for (int i = SIZE * 2; i > 0; --i) {
     buffer.record(i);
   }
   buffer.computeStats();
   return buffer;
 }
예제 #3
0
  StatsBuffer getNoWrap() {
    StatsBuffer buffer = new StatsBuffer(SIZE, PERCENTILES);

    int max = SIZE / 2;
    for (int i = 0; i <= max; ++i) {
      buffer.record(i);
    }

    buffer.computeStats();

    return buffer;
  }