@@ -51,8 +51,8 @@ void testRecordDouble() {
5151 // 1 Always belongs to index 0.
5252 base2ExponentialHistogram .recordDouble (1.000000000001 );
5353 assertThat (base2ExponentialHistogram .getScale ()).isEqualTo (MAX_SCALE );
54- assertThat (base2ExponentialHistogram .getCurrentValuesSnapshot ().zeroCount ()).isZero ();
55- assertThat (getAllBucketsCountSum (base2ExponentialHistogram .getCurrentValuesSnapshot ())).isEqualTo (1 );
54+ assertThat (base2ExponentialHistogram .getCurrentValuesSnapshot (false ).zeroCount ()).isZero ();
55+ assertThat (getAllBucketsCountSum (base2ExponentialHistogram .getCurrentValuesSnapshot (false ))).isEqualTo (1 );
5656 }
5757
5858 @ Test
@@ -66,7 +66,7 @@ void testRecordTimeBased() {
6666 // calling
6767 // recordDouble(2).
6868
69- ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
69+ ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
7070 assertThat (currentSnapshot .zeroCount ()).isZero ();
7171 assertThat (currentSnapshot .scale ()).isLessThan (MAX_SCALE );
7272 assertThat (getAllBucketsCountSum (currentSnapshot )).isEqualTo (2 );
@@ -84,13 +84,13 @@ void testRecordTimeBasedInSeconds() {
8484 // This should be same as calling recordDouble(0.05).
8585 base2ExponentialHistogram .recordLong (Duration .ofMillis (50 ).toNanos ());
8686
87- ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
87+ ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
8888 assertThat (currentSnapshot .zeroCount ()).isZero ();
8989 assertThat (currentSnapshot .scale ()).isLessThan (MAX_SCALE );
9090 assertThat (getAllBucketsCountSum (currentSnapshot )).isEqualTo (2 );
9191
9292 base2ExponentialHistogram .recordLong (Duration .ofMillis (90 ).toNanos ());
93- currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
93+ currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
9494 assertThat (currentSnapshot .scale ()).isEqualTo (1 );
9595 assertThat (getAllBucketsCountSum (currentSnapshot )).isEqualTo (3 );
9696 }
@@ -101,7 +101,7 @@ void testZeroThreshHold() {
101101 base2ExponentialHistogram .recordDouble (0.0 );
102102 base2ExponentialHistogram .recordDouble (0.5 );
103103
104- ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
104+ ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
105105 assertThat (currentSnapshot .zeroThreshold ()).isLessThan (1 ).isGreaterThan (0 );
106106 assertThat (currentSnapshot .zeroCount ()).isEqualTo (2 );
107107 assertThat (currentSnapshot .scale ()).isEqualTo (MAX_SCALE );
@@ -113,7 +113,7 @@ void testZeroThreshHold() {
113113 base2ExponentialHistogramWithZeroAsMin .recordDouble (Math .nextUp (0.0 ));
114114
115115 ExponentialHistogramSnapShot snapshotWithZeroAsMin = base2ExponentialHistogramWithZeroAsMin
116- .getCurrentValuesSnapshot ();
116+ .getCurrentValuesSnapshot (false );
117117 assertThat (snapshotWithZeroAsMin .zeroThreshold ()).isEqualTo (0.0 );
118118 assertThat (snapshotWithZeroAsMin .zeroCount ()).isEqualTo (1 );
119119 assertThat (snapshotWithZeroAsMin .scale ()).isEqualTo (MAX_SCALE );
@@ -124,7 +124,7 @@ void testZeroThreshHold() {
124124 void testDownScale () {
125125 base2ExponentialHistogram .recordDouble (1.0001 );
126126
127- ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
127+ ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
128128 assertThat (currentSnapshot .zeroCount ()).isZero ();
129129 assertThat (currentSnapshot .scale ()).isEqualTo (MAX_SCALE );
130130 assertThat (getAllBucketsCountSum (currentSnapshot )).isEqualTo (1 );
@@ -182,11 +182,11 @@ void testUpscale() {
182182
183183 @ Test
184184 void testValuesAtIndices () {
185- ExponentialHistogramSnapShot currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
185+ ExponentialHistogramSnapShot currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
186186 assertThat (currentValueSnapshot .positive ().bucketCounts ()).isEmpty ();
187187
188188 base2ExponentialHistogram .recordDouble (1.0001 );
189- currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
189+ currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
190190 assertThat (currentValueSnapshot .positive ().offset ()).isZero ();
191191 assertThat (currentValueSnapshot .positive ().bucketCounts ().get (0 )).isEqualTo (1 );
192192 assertThat (currentValueSnapshot .positive ().bucketCounts ()).filteredOn (value -> value == 0 ).isEmpty ();
@@ -195,7 +195,7 @@ void testValuesAtIndices() {
195195
196196 base2ExponentialHistogram .recordDouble (1.0076 );
197197 base2ExponentialHistogram .recordDouble (1.008 );
198- currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
198+ currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
199199 assertThat (currentValueSnapshot .positive ().offset ()).isZero ();
200200 assertThat (base2ExponentialHistogram .getScale ()).isEqualTo (MAX_SCALE );
201201 assertThat (currentValueSnapshot .positive ().bucketCounts ().get (0 )).isEqualTo (1 );
@@ -206,7 +206,7 @@ void testValuesAtIndices() {
206206 // We will record a value that will downscale by 1 and this should merge 2
207207 // consecutive buckets into one.
208208 base2ExponentialHistogram .recordDouble (1.012 );
209- currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
209+ currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
210210 assertThat (currentValueSnapshot .positive ().offset ()).isZero ();
211211 assertThat (base2ExponentialHistogram .getScale ()).isEqualTo (MAX_SCALE - 1 );
212212 assertThat (currentValueSnapshot .positive ().bucketCounts ().get (0 )).isEqualTo (2 );
@@ -216,7 +216,7 @@ void testValuesAtIndices() {
216216
217217 // The base will reduced by a factor of more than one,
218218 base2ExponentialHistogram .recordDouble (4 );
219- currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
219+ currentValueSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
220220 assertThat (currentValueSnapshot .positive ().offset ()).isZero ();
221221 assertThat (base2ExponentialHistogram .getScale ()).isEqualTo (3 );
222222 assertThat (currentValueSnapshot .positive ().bucketCounts ().get (0 )).isEqualTo (5 );
@@ -242,15 +242,15 @@ void reset() {
242242 base2ExponentialHistogram .recordDouble (1 );
243243 base2ExponentialHistogram .recordDouble (2 );
244244
245- ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
245+ ExponentialHistogramSnapShot currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
246246 final int intialScale = currentSnapshot .scale ();
247247 assertThat (currentSnapshot .zeroCount ()).isEqualTo (1 );
248248 assertThat (currentSnapshot .scale ()).isLessThan (MAX_SCALE );
249249 assertThat (currentSnapshot .positive ().offset ()).isNotZero ();
250250 assertThat (getAllBucketsCountSum (currentSnapshot )).isEqualTo (2 );
251251
252252 base2ExponentialHistogram .reset ();
253- currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot ();
253+ currentSnapshot = base2ExponentialHistogram .getCurrentValuesSnapshot (false );
254254 assertThat (currentSnapshot .zeroCount ()).isZero ();
255255 assertThat (currentSnapshot .scale ()).isEqualTo (intialScale );
256256 assertThat (currentSnapshot .positive ().offset ()).isZero ();
0 commit comments