changeset 228:964327327052

Rebuild the SamplingBuffer interface, #2.
author shade
date Mon, 04 Nov 2013 13:01:06 +0100
parents d43fbb55c77b
children d8cf91cbbdda
files jmh-core/src/main/java/org/openjdk/jmh/util/internal/SampleBuffer.java
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/internal/SampleBuffer.java	Mon Nov 04 12:44:38 2013 +0100
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/internal/SampleBuffer.java	Mon Nov 04 13:01:06 2013 +0100
@@ -39,10 +39,6 @@
 
     public SampleBuffer() {
         hdr = new int[64][];
-        clear();
-    }
-
-    private void clear() {
         for (int p = 0; p < 64; p++) {
             hdr[p] = new int[1 << PRECISION_BITS];
         }
@@ -51,7 +47,10 @@
     public void half() {
         for (int i = 0; i < 64; i++) {
             for (int j = 0; j < hdr[i].length; j++) {
-                hdr[i][j] = Math.max(hdr[i][j], hdr[i][j] / 2); // prevent halving to zero
+                int nV = hdr[i][j] / 2;
+                if (nV != 0) { // prevent halving to zero
+                    hdr[i][j] = nV;
+                }
             }
         }
     }