changeset 162:215073a11ca8

Merging IterationResult into IterationData, phase 2.
author shade
date Thu, 29 Aug 2013 19:24:08 +0400
parents 73c3a6c35b9e
children ca3102a6f220
files jmh-core/src/main/java/org/openjdk/jmh/logic/results/AverageTimePerOp.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/OpsPerTimeUnit.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/ResultRole.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAverageTimePerOp.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestOpsPerTimeUnit.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSampleTimePerOp.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSingleShotTime.java
diffstat 13 files changed, 151 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/AverageTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/AverageTimePerOp.java	Thu Aug 29 19:24:08 2013 +0400
@@ -50,12 +50,12 @@
      * @param durationNs       Duration of iteration in NanoSeconds
      * @param tu The TimeUnit to use when calculating the score
      */
-    public AverageTimePerOp(String label, long operations, long durationNs, TimeUnit tu) {
-        this(label, operations, durationNs, tu, null);
+    public AverageTimePerOp(ResultRole mode, String label, long operations, long durationNs, TimeUnit tu) {
+        this(mode, label, operations, durationNs, tu, null);
     }
 
-    AverageTimePerOp(String label, long operations, long durationNs, TimeUnit tu, Statistics stat) {
-        super(label, stat);
+    AverageTimePerOp(ResultRole mode, String label, long operations, long durationNs, TimeUnit tu, Statistics stat) {
+        super(mode, label, stat);
         this.operations = operations;
         this.durationNs = durationNs;
         this.outputTimeUnit = tu;
@@ -90,18 +90,20 @@
         @Override
         public AverageTimePerOp aggregate(Collection<AverageTimePerOp> results) {
             Statistics stat = new Statistics();
+            ResultRole mode = null;
             String label = null;
             long operations = 0;
             long duration = 0;
             TimeUnit tu = null;
             for (AverageTimePerOp r : results) {
+                mode = r.mode;
                 label = r.label;
                 tu = r.outputTimeUnit;
                 operations += r.operations;
                 duration += r.durationNs;
                 stat.addValue(r.getScore());
             }
-            return new AverageTimePerOp(label, operations, duration, tu, stat);
+            return new AverageTimePerOp(mode, label, operations, duration, tu, stat);
         }
     }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java	Thu Aug 29 19:24:08 2013 +0400
@@ -47,6 +47,7 @@
     private final BenchmarkRecord benchmark;
     private final IterationParams params;
     private final List<Result> primaryResults;
+    private final Multimap<String, Result> secondaryResults;
     private final List<ProfilerResult> profilerResults;
     private String scoreUnit;
 
@@ -55,28 +56,24 @@
         this.params = params;
         this.primaryResults = new ArrayList<Result>(params.getThreads());
         this.profilerResults = new ArrayList<ProfilerResult>();
+        this.secondaryResults = new TreeMultimap<String, Result>();
     }
 
     public void addResult(Result result) {
-        if (scoreUnit == null) {
-            scoreUnit = result.getScoreUnit();
-        } else {
-            if (!scoreUnit.equals(result.getScoreUnit())) {
-                throw new IllegalStateException("Adding the result with another score unit!");
+        if (result.getMode().primary()) {
+            if (scoreUnit == null) {
+                scoreUnit = result.getScoreUnit();
+            } else {
+                if (!scoreUnit.equals(result.getScoreUnit())) {
+                    throw new IllegalStateException("Adding the result with another score unit!");
+                }
             }
+            primaryResults.add(result);
         }
 
-//        if (label != null) {
-//            if (!label.equals(result.getLabel())) {
-//                throw new IllegalStateException("Aggregating the results with different labels");
-//            }
-//        } else {
-//            label = r.label;
-//        }
-
-        primaryResults.add(result);
-
-        // FIXME: Take care of secondary results and separate them by label
+        if (result.getMode().secondary()) {
+            secondaryResults.put(result.getLabel(), result);
+        }
     }
 
     public List<Result> getPrimaryResults() {
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/OpsPerTimeUnit.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/OpsPerTimeUnit.java	Thu Aug 29 19:24:08 2013 +0400
@@ -49,8 +49,8 @@
      * @param operations Total number of operations during iteration
      * @param durationNs   Duration of iteration in NanoSeconds
      */
-    public OpsPerTimeUnit(String label, long operations, long durationNs) {
-        this(label, operations, durationNs, TimeUnit.MILLISECONDS);
+    public OpsPerTimeUnit(ResultRole treat, String label, long operations, long durationNs) {
+        this(treat, label, operations, durationNs, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -60,12 +60,12 @@
      * @param durationNs       Duration of iteration in NanoSeconds
      * @param outputTimeUnit The TimeUnit to use when calculating the score
      */
-    public OpsPerTimeUnit(String label, long operations, long durationNs, TimeUnit outputTimeUnit) {
-        this(label, operations, durationNs, outputTimeUnit, null);
+    public OpsPerTimeUnit(ResultRole treat, String label, long operations, long durationNs, TimeUnit outputTimeUnit) {
+        this(treat, label, operations, durationNs, outputTimeUnit, null);
     }
 
-    OpsPerTimeUnit(String label, long operations, long durationNs, TimeUnit outputTimeUnit, Statistics stats) {
-        super(label, stats);
+    OpsPerTimeUnit(ResultRole treat, String label, long operations, long durationNs, TimeUnit outputTimeUnit, Statistics stats) {
+        super(treat, label, stats);
         this.operations = operations;
         this.durationNs = durationNs;
         this.outputTimeUnit = outputTimeUnit;
@@ -96,10 +96,12 @@
 
                 final long normalizedDuration = TimeUnit.MINUTES.toNanos(1);
 
+                ResultRole mode = null;
                 String label = null;
                 long operations = 0;
                 TimeUnit tu = null;
                 for (OpsPerTimeUnit r : results) {
+                    mode = r.mode;
                     tu = r.outputTimeUnit;
                     label = r.label;
 
@@ -107,7 +109,7 @@
                     operations += Math.round(r.operations * (1.0 * normalizedDuration / r.durationNs));
                 }
 
-                return new OpsPerTimeUnit(label, operations, normalizedDuration, tu, stat);
+                return new OpsPerTimeUnit(mode, label, operations, normalizedDuration, tu, stat);
             }
         };
     }
@@ -125,10 +127,12 @@
 
                 final long normalizedDuration = TimeUnit.MINUTES.toNanos(1);
 
+                ResultRole mode = null;
                 String label = null;
                 long operations = 0;
                 TimeUnit tu = null;
                 for (OpsPerTimeUnit r : results) {
+                    mode = r.mode;
                     tu = r.outputTimeUnit;
                     label = r.label;
 
@@ -137,7 +141,7 @@
                 }
                 operations /= results.size();
 
-                return new OpsPerTimeUnit(label, operations, normalizedDuration, tu, stat);
+                return new OpsPerTimeUnit(mode, label, operations, normalizedDuration, tu, stat);
             }
         };
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java	Thu Aug 29 19:24:08 2013 +0400
@@ -39,10 +39,12 @@
  */
 public abstract class Result<T extends Result<T>> implements Serializable {
 
+    protected final ResultRole mode;
     protected final String label;
     protected final Statistics statistics;
 
-    public Result(String label, Statistics statistics) {
+    public Result(ResultRole mode, String label, Statistics statistics) {
+        this.mode = mode;
         this.label = label;
         this.statistics = statistics == null ? new Statistics() : statistics;
     }
@@ -140,12 +142,7 @@
         return label;
     }
 
-    public String toPrintableScore() {
-        NumberFormat nf = NumberFormat.getInstance();
-        nf.setMaximumFractionDigits(3);
-        nf.setMinimumFractionDigits(3);
-        nf.setGroupingUsed(false);
-
-        return nf.format(getScore());
+    public ResultRole getMode() {
+        return mode;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/ResultRole.java	Thu Aug 29 19:24:08 2013 +0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.openjdk.jmh.logic.results;
+
+public enum ResultRole {
+    PRIMARY(true, false),
+    SECONDARY(false, true),
+    BOTH(true, true),
+
+    ;
+
+    private final boolean primary;
+    private final boolean secondary;
+
+    ResultRole(boolean primary, boolean secondary) {
+        this.primary = primary;
+        this.secondary = secondary;
+    }
+
+    public boolean primary() {
+        return primary;
+    }
+
+    public boolean secondary() {
+        return secondary;
+    }
+
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 19:24:08 2013 +0400
@@ -44,8 +44,8 @@
     private final TimeUnit outputTimeUnit;
 
     /** Sets up the result with the default output unit MilliSeconds */
-    public SampleTimePerOp(String label, SampleBuffer buffer) {
-        this(label, buffer, TimeUnit.MILLISECONDS);
+    public SampleTimePerOp(ResultRole mode, String label, SampleBuffer buffer) {
+        this(mode, label, buffer, TimeUnit.MILLISECONDS);
     }
 
     /**
@@ -53,8 +53,8 @@
      *
      * @param outputTimeUnit The TimeUnit to use when calculating the score
      */
-    public SampleTimePerOp(String label, SampleBuffer buffer, TimeUnit outputTimeUnit) {
-        super(label, null);
+    public SampleTimePerOp(ResultRole mode, String label, SampleBuffer buffer, TimeUnit outputTimeUnit) {
+        super(mode, label, null);
         this.buffer = buffer;
         this.outputTimeUnit = outputTimeUnit;
     }
@@ -192,6 +192,7 @@
             }
 
             // generate new sample buffer
+            ResultRole mode = null;
             String label = null;
             SampleBuffer buffer = new SampleBuffer(size);
             TimeUnit tu = null;
@@ -201,7 +202,7 @@
                 buffer.addAll(r.buffer.getSamples());
             }
 
-            return new SampleTimePerOp(label, buffer, tu);
+            return new SampleTimePerOp(mode, label, buffer, tu);
         }
     }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java	Thu Aug 29 19:24:08 2013 +0400
@@ -47,12 +47,12 @@
      * @param duration       Duration of iteration in NanoSeconds
      * @param outputTimeUnit The TimeUnit to use when calculating the score
      */
-    public SingleShotTime(String label, long duration, TimeUnit outputTimeUnit) {
-        this(label, duration, outputTimeUnit, null);
+    public SingleShotTime(ResultRole mode, String label, long duration, TimeUnit outputTimeUnit) {
+        this(mode, label, duration, outputTimeUnit, null);
     }
 
-    SingleShotTime(String label, long duration, TimeUnit outputTimeUnit, Statistics stat) {
-        super(label, stat);
+    SingleShotTime(ResultRole mode, String label, long duration, TimeUnit outputTimeUnit, Statistics stat) {
+        super(mode, label, stat);
         this.duration = duration;
         this.outputTimeUnit = outputTimeUnit;
     }
@@ -85,17 +85,19 @@
     public static class AveragingAggregator implements Aggregator<SingleShotTime> {
         @Override
         public Result aggregate(Collection<SingleShotTime> results) {
+            ResultRole mode = null;
             String label = null;
             Statistics stat = new Statistics();
             long duration = 0;
             TimeUnit tu = null;
             for (SingleShotTime r : results) {
+                mode = r.mode;
                 tu = r.outputTimeUnit;
                 label = r.label;
                 duration += r.duration;
                 stat.addValue(r.getScore());
             }
-            return new SingleShotTime(label, duration / results.size(), tu, stat);
+            return new SingleShotTime(mode, label, duration / results.size(), tu, stat);
         }
 
     }
--- a/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Thu Aug 29 19:24:08 2013 +0400
@@ -42,6 +42,7 @@
 import org.openjdk.jmh.logic.results.OpsPerTimeUnit;
 import org.openjdk.jmh.logic.results.RawResultPair;
 import org.openjdk.jmh.logic.results.Result;
+import org.openjdk.jmh.logic.results.ResultRole;
 import org.openjdk.jmh.logic.results.SampleTimePerOp;
 import org.openjdk.jmh.logic.results.SingleShotTime;
 import org.openjdk.jmh.runner.MicroBenchmarkList;
@@ -409,6 +410,7 @@
         writer.println("import " + Warmup.class.getName() + ';');
         writer.println("import " + BenchmarkMode.class.getName() + ';');
         writer.println("import " + RawResultPair.class.getName() + ';');
+        writer.println("import " + ResultRole.class.getName() + ';');
         writer.println();
     }
 
@@ -713,7 +715,8 @@
             // iteration prolog
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new OpsPerTimeUnit(\"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
+            ResultRole mode = (methodGroup.methods().size() == 1) ? ResultRole.PRIMARY : ResultRole.BOTH;
+            writer.println(ident(3) + "return new OpsPerTimeUnit(ResultRole." + mode + ", \"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
@@ -801,7 +804,8 @@
 
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new AverageTimePerOp(\"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
+            ResultRole mode = (methodGroup.methods().size() == 1) ? ResultRole.PRIMARY : ResultRole.BOTH;
+            writer.println(ident(3) + "return new AverageTimePerOp(ResultRole." + mode + ", \"" + method.getSimpleName() + "\", res.operations, res.time, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
@@ -947,7 +951,9 @@
             invocationEpilog(writer, 4, method, states, true);
 
             writer.println("        } while(!control.isDone);");
-            writer.println("        return new SampleTimePerOp(\"" + method.getSimpleName() + "\", buffer, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
+
+            ResultRole mode = (methodGroup.methods().size() == 1) ? ResultRole.PRIMARY : ResultRole.BOTH;
+            writer.println("        return new SampleTimePerOp(ResultRole." + mode + ", \"" + method.getSimpleName() + "\", buffer, (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println("    }");
             writer.println();
         }
@@ -983,7 +989,8 @@
 
             iterationEpilog(writer, 3, method, states);
 
-            writer.println(ident(3) + "return new SingleShotTime(\"" + method.getSimpleName() + "\", (realTime > 0) ? realTime : (time2 - time1), (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
+            ResultRole mode = (methodGroup.methods().size() == 1) ? ResultRole.PRIMARY : ResultRole.BOTH;
+            writer.println(ident(3) + "return new SingleShotTime(ResultRole." + mode + ",\"" + method.getSimpleName() + "\", (realTime > 0) ? realTime : (time2 - time1), (control.timeUnit != null) ? control.timeUnit : TimeUnit." + timeUnit + ");");
             writer.println(ident(2) + "} else");
         }
         writer.println(ident(3) + "throw new IllegalStateException(\"Harness failed to distribute threads among groups properly\");");
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 19:24:08 2013 +0400
@@ -48,7 +48,7 @@
     public static void setupClass() {
         result = new IterationData(new BenchmarkRecord("blah,blah," + Mode.AverageTime), new IterationParams(1, TimeValue.days(1), 1));
         for (double d : values) {
-            result.addResult(new OpsPerTimeUnit("test1", (long) d, 10 * 1000 * 1000));
+            result.addResult(new OpsPerTimeUnit(ResultRole.BOTH, "test1", (long) d, 10 * 1000 * 1000));
         }
     }
 
@@ -59,7 +59,7 @@
 
     @Test
     public void testScoreUnit() throws Exception {
-        assertEquals((new OpsPerTimeUnit("test1", 1, 1)).getScoreUnit(), result.getScoreUnit());
+        assertEquals((new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1, 1)).getScoreUnit(), result.getScoreUnit());
     }
 
 }
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAverageTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAverageTimePerOp.java	Thu Aug 29 19:24:08 2013 +0400
@@ -39,8 +39,8 @@
 
     @Test
     public void testRunAggregator1() {
-        AverageTimePerOp r1 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
-        AverageTimePerOp r2 = new AverageTimePerOp("test1", 1000L, 2000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r1 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r2 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 2000000L, TimeUnit.MICROSECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.5, result.getScore());
@@ -49,8 +49,8 @@
 
     @Test
     public void testRunAggregator2() {
-        AverageTimePerOp r1 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
-        AverageTimePerOp r2 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r1 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r2 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.0, result.getScore());
@@ -59,8 +59,8 @@
 
     @Test
     public void testIterationAggregator1() {
-        AverageTimePerOp r1 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
-        AverageTimePerOp r2 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r1 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r2 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.0, result.getScore());
@@ -69,8 +69,8 @@
 
     @Test
     public void testIterationAggregator2() {
-        AverageTimePerOp r1 = new AverageTimePerOp("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
-        AverageTimePerOp r2 = new AverageTimePerOp("test1", 1000L, 2000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r1 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        AverageTimePerOp r2 = new AverageTimePerOp(ResultRole.BOTH, "test1", 1000L, 2000000L, TimeUnit.MICROSECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.5, result.getScore());
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestOpsPerTimeUnit.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestOpsPerTimeUnit.java	Thu Aug 29 19:24:08 2013 +0400
@@ -42,49 +42,49 @@
      */
     @Test
     public void testGetScore() {
-        OpsPerTimeUnit instance = new OpsPerTimeUnit("test1", 1000L, 1000000L);
+        OpsPerTimeUnit instance = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L);
         assertEquals(1000, instance.getScore(), 0.0);
-        OpsPerTimeUnit instance2 = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.SECONDS);
+        OpsPerTimeUnit instance2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.SECONDS);
         assertEquals(1000000, instance2.getScore(), 0.0);
-        OpsPerTimeUnit instance3 = new OpsPerTimeUnit("test1", 1000L, 1000L);
+        OpsPerTimeUnit instance3 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000L);
         assertEquals(1000 / (1000 / (double) 1000000), instance3.getScore(), 0.0);
     }
 
     @Test
     public void testTimeUnits() {
-        OpsPerTimeUnit instanced = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.DAYS);
+        OpsPerTimeUnit instanced = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.DAYS);
         assertEquals(86400000000D, instanced.getScore(), 0.0);
         assertEquals("ops/day", instanced.getScoreUnit());
 
-        OpsPerTimeUnit instanceh = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.HOURS);
+        OpsPerTimeUnit instanceh = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.HOURS);
         assertEquals(3600000000.0000005D, instanceh.getScore(), 0.0);
         assertEquals("ops/hour", instanceh.getScoreUnit());
 
-        OpsPerTimeUnit instancem = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.MINUTES);
+        OpsPerTimeUnit instancem = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MINUTES);
         assertEquals(60000000, instancem.getScore(), 0.0);
         assertEquals("ops/min", instancem.getScoreUnit());
 
-        OpsPerTimeUnit instance = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.SECONDS);
+        OpsPerTimeUnit instance = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.SECONDS);
         assertEquals(1000000, instance.getScore(), 0.0);
         assertEquals("ops/sec", instance.getScoreUnit());
 
-        OpsPerTimeUnit instance2 = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit instance2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MILLISECONDS);
         assertEquals(1000, instance2.getScore(), 0.0);
         assertEquals("ops/msec", instance2.getScoreUnit());
 
-        OpsPerTimeUnit instance3 = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
+        OpsPerTimeUnit instance3 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.MICROSECONDS);
         assertEquals(1, instance3.getScore(), 0.0);
         assertEquals("ops/usec", instance3.getScoreUnit());
 
-        OpsPerTimeUnit instance4 = new OpsPerTimeUnit("test1", 1000L, 1000000L, TimeUnit.NANOSECONDS);
+        OpsPerTimeUnit instance4 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 1000000L, TimeUnit.NANOSECONDS);
         assertEquals(0.001, instance4.getScore(), 0.0);
         assertEquals("ops/nsec", instance4.getScoreUnit());
     }
 
     @Test
     public void testRunAggregator1() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000L, 10000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(150.0, result.getScore());
@@ -93,8 +93,8 @@
 
     @Test
     public void testRunAggregator2() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000L, 20000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000L, 20000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(100.0, result.getScore());
@@ -103,8 +103,8 @@
 
     @Test // regression test, check for overflow
     public void testRunAggregator3() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000000000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000000000L, 20000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000000000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000000000L, 20000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(100000000.0, result.getScore());
@@ -113,8 +113,8 @@
 
     @Test
     public void testIterationAggregator1() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000L, 10000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals("ops/msec", result.getScoreUnit());
@@ -123,8 +123,8 @@
 
     @Test
     public void testIterationAggregator2() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000L, 20000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000L, 20000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals("ops/msec", result.getScoreUnit());
@@ -133,8 +133,8 @@
 
     @Test  // regression test, check for overflow
     public void testIterationAggregator3() {
-        OpsPerTimeUnit r1 = new OpsPerTimeUnit("test1", 1000000000L, 10000000L, TimeUnit.MILLISECONDS);
-        OpsPerTimeUnit r2 = new OpsPerTimeUnit("test1", 2000000000L, 20000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r1 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 1000000000L, 10000000L, TimeUnit.MILLISECONDS);
+        OpsPerTimeUnit r2 = new OpsPerTimeUnit(ResultRole.BOTH, "test1", 2000000000L, 20000000L, TimeUnit.MILLISECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals("ops/msec", result.getScoreUnit());
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSampleTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSampleTimePerOp.java	Thu Aug 29 19:24:08 2013 +0400
@@ -48,8 +48,8 @@
         b2.add(3000);
         b2.add(4000);
 
-        SampleTimePerOp r1 = new SampleTimePerOp("Test1", b1, TimeUnit.MICROSECONDS);
-        SampleTimePerOp r2 = new SampleTimePerOp("Test1", b2, TimeUnit.MICROSECONDS);
+        SampleTimePerOp r1 = new SampleTimePerOp(ResultRole.BOTH, "Test1", b1, TimeUnit.MICROSECONDS);
+        SampleTimePerOp r2 = new SampleTimePerOp(ResultRole.BOTH, "Test1", b2, TimeUnit.MICROSECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(2.5, result.getScore());
@@ -66,8 +66,8 @@
         b2.add(3000);
         b2.add(4000);
 
-        SampleTimePerOp r1 = new SampleTimePerOp("Test1", b1, TimeUnit.MICROSECONDS);
-        SampleTimePerOp r2 = new SampleTimePerOp("Test1", b2, TimeUnit.MICROSECONDS);
+        SampleTimePerOp r1 = new SampleTimePerOp(ResultRole.BOTH, "Test1", b1, TimeUnit.MICROSECONDS);
+        SampleTimePerOp r2 = new SampleTimePerOp(ResultRole.BOTH, "Test1", b2, TimeUnit.MICROSECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(2.5, result.getScore());
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSingleShotTime.java	Thu Aug 29 18:41:53 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestSingleShotTime.java	Thu Aug 29 19:24:08 2013 +0400
@@ -39,8 +39,8 @@
 
     @Test
     public void testRunAggregator1() {
-        SingleShotTime r1 = new SingleShotTime("Test1", 1000L, TimeUnit.MICROSECONDS);
-        SingleShotTime r2 = new SingleShotTime("Test1", 2000L, TimeUnit.MICROSECONDS);
+        SingleShotTime r1 = new SingleShotTime(ResultRole.BOTH, "Test1", 1000L, TimeUnit.MICROSECONDS);
+        SingleShotTime r2 = new SingleShotTime(ResultRole.BOTH, "Test1", 2000L, TimeUnit.MICROSECONDS);
         Result result = r1.getRunAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.5, result.getScore());
@@ -49,8 +49,8 @@
 
     @Test
     public void testIterationAggregator1() {
-        SingleShotTime r1 = new SingleShotTime("Test1", 1000L, TimeUnit.MICROSECONDS);
-        SingleShotTime r2 = new SingleShotTime("Test1", 2000L, TimeUnit.MICROSECONDS);
+        SingleShotTime r1 = new SingleShotTime(ResultRole.BOTH, "Test1", 1000L, TimeUnit.MICROSECONDS);
+        SingleShotTime r2 = new SingleShotTime(ResultRole.BOTH, "Test1", 2000L, TimeUnit.MICROSECONDS);
         Result result = r1.getIterationAggregator().aggregate(Arrays.asList(r1, r2));
 
         assertEquals(1.5, result.getScore());