1818
1919public class ExponentialBucketHistogramTests extends ESTestCase {
2020
21- public void testHistogram () {
21+ public void testSnapshot () {
2222 final ExponentialBucketHistogram histogram = new ExponentialBucketHistogram ();
2323
24- assertArrayEquals (new long [] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
24+ assertArrayEquals (new long [] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
2525
2626 histogram .addObservation (0L );
27- assertArrayEquals (new long [] { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
27+ assertArrayEquals (new long [] { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
2828
2929 histogram .addObservation (1L );
30- assertArrayEquals (new long [] { 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
30+ assertArrayEquals (new long [] { 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
3131
3232 histogram .addObservation (2L );
33- assertArrayEquals (new long [] { 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
33+ assertArrayEquals (new long [] { 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
3434
3535 histogram .addObservation (3L );
36- assertArrayEquals (new long [] { 1 , 1 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
36+ assertArrayEquals (new long [] { 1 , 1 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
3737
3838 histogram .addObservation (4L );
39- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
39+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
4040
4141 histogram .addObservation (127L );
42- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
42+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
4343
4444 histogram .addObservation (128L );
45- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getHistogram ());
45+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, histogram .getSnapshot ());
4646
4747 histogram .addObservation (65535L );
48- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 }, histogram .getHistogram ());
48+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 }, histogram .getSnapshot ());
4949
5050 histogram .addObservation (65536L );
51- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 }, histogram .getHistogram ());
51+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 }, histogram .getSnapshot ());
5252
5353 histogram .addObservation (Long .MAX_VALUE );
54- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 }, histogram .getHistogram ());
54+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 }, histogram .getSnapshot ());
5555
5656 histogram .addObservation (randomLongBetween (65536L , Long .MAX_VALUE ));
57- assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 3 }, histogram .getHistogram ());
57+ assertArrayEquals (new long [] { 1 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 3 }, histogram .getSnapshot ());
5858
5959 histogram .addObservation (randomLongBetween (Long .MIN_VALUE , 0L ));
60- assertArrayEquals (new long [] { 2 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 3 }, histogram .getHistogram ());
60+ assertArrayEquals (new long [] { 2 , 1 , 2 , 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 3 }, histogram .getSnapshot ());
6161 }
6262
6363 public void testHistogramRandom () {
@@ -73,7 +73,7 @@ public void testHistogramRandom() {
7373 histogram .addObservation (between (lowerBound , upperBound ));
7474 }
7575
76- assertArrayEquals (expectedCounts , histogram .getHistogram ());
76+ assertArrayEquals (expectedCounts , histogram .getSnapshot ());
7777 }
7878
7979 public void testBoundsConsistency () {
0 commit comments