changeset 161:73c3a6c35b9e

Merging IterationResult into IterationData, phase 1.
author shade
date Thu, 29 Aug 2013 18:41:53 +0400
parents f75b8c3a1ded
children 215073a11ca8
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/SampleTimePerOp.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/IterationResult.java jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java
diffstat 13 files changed, 142 insertions(+), 276 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/AverageTimePerOp.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/AverageTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
@@ -95,22 +95,8 @@
             long duration = 0;
             TimeUnit tu = null;
             for (AverageTimePerOp r : results) {
-                if (tu != null) {
-                    if (!tu.equals(r.outputTimeUnit)) {
-                        throw new IllegalStateException("Aggregating the results with different TUs");
-                    }
-                } else {
-                    tu = r.outputTimeUnit;
-                }
-
-                if (label != null) {
-                    if (!label.equals(r.label)) {
-                        throw new IllegalStateException("Aggregating the results with different labels");
-                    }
-                } else {
-                    label = r.label;
-                }
-
+                label = r.label;
+                tu = r.outputTimeUnit;
                 operations += r.operations;
                 duration += r.durationNs;
                 stat.addValue(r.getScore());
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java	Thu Aug 29 18:41:53 2013 +0400
@@ -27,44 +27,81 @@
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.parameters.IterationParams;
-import org.openjdk.jmh.runner.parameters.TimeValue;
+import org.openjdk.jmh.util.internal.Multimap;
+import org.openjdk.jmh.util.internal.TreeMultimap;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Class contains all info returned by microbenchmark iteration or/and collected during microbenchmark iteration.
  *
  * @author sergey.kuksenko@oracle.com
  */
-public class IterationData {
+public class IterationData implements Serializable {
 
     private final BenchmarkRecord benchmark;
     private final IterationParams params;
-    private final List<Result> perThreadResults;
+    private final List<Result> primaryResults;
     private final List<ProfilerResult> profilerResults;
+    private String scoreUnit;
 
     public IterationData(BenchmarkRecord benchmark, IterationParams params) {
         this.benchmark = benchmark;
         this.params = params;
-        this.perThreadResults = new ArrayList<Result>(params.getThreads());
+        this.primaryResults = new ArrayList<Result>(params.getThreads());
         this.profilerResults = new ArrayList<ProfilerResult>();
     }
 
     public void addResult(Result result) {
-        perThreadResults.add(result);
+        if (scoreUnit == null) {
+            scoreUnit = result.getScoreUnit();
+        } else {
+            if (!scoreUnit.equals(result.getScoreUnit())) {
+                throw new IllegalStateException("Adding the result with another score unit!");
+            }
+        }
+
+//        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
     }
 
-    public List<Result> getRawResults() {
-        return perThreadResults;
+    public List<Result> getPrimaryResults() {
+        return primaryResults;
+    }
+
+    public Result getPrimaryResult() {
+        Multimap<String, Result> results = new TreeMultimap<String, Result>();
+        for (Result r : primaryResults) {
+            results.put(r.getLabel(), r);
+        }
+
+        Result next = primaryResults.iterator().next();
+
+        @SuppressWarnings("unchecked")
+        Aggregator<Result> aggregator = next.getIterationAggregator();
+        return aggregator.aggregate(primaryResults);
     }
 
     public boolean isResultsEmpty() {
-        return perThreadResults.isEmpty();
+        return primaryResults.isEmpty();
     }
 
     public void clearResults() {
-        perThreadResults.clear();
+        primaryResults.clear();
     }
 
     public BenchmarkRecord getBenchmark() {
@@ -83,4 +120,40 @@
         return profilerResults;
     }
 
+    public String getScoreUnit() {
+        return scoreUnit;
+    }
+
+    public String toPrintable() {
+        return getPrimaryResult().toString();
+//        if (primaryResults.size() > 1) {
+//            boolean first = true;
+//            StringBuilder sb = new StringBuilder();
+//            String unit = "";
+//            for (Map.Entry<String, Result> res : primaryResults.entrySet()) {
+//                if (!first) {
+//                    sb.append(", ");
+//                }
+//                first = false;
+//
+//                // rough estimate
+//                int threads = primaryResults.get(res.getKey()).size();
+//
+//                sb.append(res.getKey());
+//                sb.append("{t=").append(threads).append("}");
+//                sb.append(" = ");
+//                sb.append(res.getValue().toPrintableScore());
+//
+//                unit = res.getValue().getScoreUnit();
+//            }
+//            sb.append(" ");
+//            sb.append(unit);
+//            return sb.toString();
+//        } else if (result.size() == 1) {
+//            return result.values().iterator().next().toString();
+//        } else {
+//            return "N/A";
+//        }
+    }
+
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/OpsPerTimeUnit.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/OpsPerTimeUnit.java	Thu Aug 29 18:41:53 2013 +0400
@@ -100,21 +100,8 @@
                 long operations = 0;
                 TimeUnit tu = null;
                 for (OpsPerTimeUnit r : results) {
-                    if (tu != null) {
-                        if (!tu.equals(r.outputTimeUnit)) {
-                            throw new IllegalStateException("Aggregating the results with different TUs");
-                        }
-                    } else {
-                        tu = r.outputTimeUnit;
-                    }
-
-                    if (label != null) {
-                        if (!label.equals(r.label)) {
-                            throw new IllegalStateException("Aggregating the results with different labels");
-                        }
-                    } else {
-                        label = r.label;
-                    }
+                    tu = r.outputTimeUnit;
+                    label = r.label;
 
                     // care about long overflow
                     operations += Math.round(r.operations * (1.0 * normalizedDuration / r.durationNs));
@@ -142,21 +129,8 @@
                 long operations = 0;
                 TimeUnit tu = null;
                 for (OpsPerTimeUnit r : results) {
-                    if (tu != null) {
-                        if (!tu.equals(r.outputTimeUnit)) {
-                            throw new IllegalStateException("Aggregating the results with different TUs");
-                        }
-                    } else {
-                        tu = r.outputTimeUnit;
-                    }
-
-                    if (label != null) {
-                        if (!label.equals(r.label)) {
-                            throw new IllegalStateException("Aggregating the results with different labels");
-                        }
-                    } else {
-                        label = r.label;
-                    }
+                    tu = r.outputTimeUnit;
+                    label = r.label;
 
                     // care about long overflow
                     operations += Math.round(r.operations * (1.0 * normalizedDuration / r.durationNs));
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 18:41:53 2013 +0400
@@ -196,22 +196,8 @@
             SampleBuffer buffer = new SampleBuffer(size);
             TimeUnit tu = null;
             for (SampleTimePerOp r : results) {
-                if (tu != null) {
-                    if (!tu.equals(r.outputTimeUnit)) {
-                        throw new IllegalStateException("Aggregating the results with different TUs");
-                    }
-                } else {
-                    tu = r.outputTimeUnit;
-                }
-
-                if (label != null) {
-                    if (!label.equals(r.label)) {
-                        throw new IllegalStateException("Aggregating the results with different labels");
-                    }
-                } else {
-                    label = r.label;
-                }
-
+                tu = r.outputTimeUnit;
+                label = r.label;
                 buffer.addAll(r.buffer.getSamples());
             }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SingleShotTime.java	Thu Aug 29 18:41:53 2013 +0400
@@ -90,22 +90,8 @@
             long duration = 0;
             TimeUnit tu = null;
             for (SingleShotTime r : results) {
-                if (tu != null) {
-                    if (!tu.equals(r.outputTimeUnit)) {
-                        throw new IllegalStateException("Aggregating the results with different TUs");
-                    }
-                } else {
-                    tu = r.outputTimeUnit;
-                }
-
-                if (label != null) {
-                    if (!label.equals(r.label)) {
-                        throw new IllegalStateException("Aggregating the results with different labels");
-                    }
-                } else {
-                    label = r.label;
-                }
-
+                tu = r.outputTimeUnit;
+                label = r.label;
                 duration += r.duration;
                 stat.addValue(r.getScore());
             }
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/IterationResult.java	Thu Aug 29 17:31:25 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
- * 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.internal;
-
-import org.openjdk.jmh.logic.results.Aggregator;
-import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.util.internal.Multimap;
-import org.openjdk.jmh.util.internal.TreeMultimap;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-/**
- * Complete iteration result.
- * Contains the sub-thread results.
- *
- * @author anders.astrand@oracle.com
- * @author aleksey.shipilev@oracle.com
- */
-public class IterationResult implements Serializable {
-
-    private static final long serialVersionUID = 9128620268354234707L;
-
-    /** Original list of Result */
-    private final Multimap<String, Result> results;
-
-    /** Aggregated result */
-    private final Map<String, Result> result;
-
-    /**
-     * Constructor
-     *
-     * @param rrs Results from the threads
-     */
-    public IterationResult(List<Result> rrs) {
-        this.results = new TreeMultimap<String, Result>();
-        for (Result r : rrs) {
-            results.put(r.getLabel(), r);
-        }
-
-        this.result = new TreeMap<String, Result>();
-        if (!rrs.isEmpty()) {
-            Result next = rrs.iterator().next();
-
-            @SuppressWarnings("unchecked")
-            Aggregator<Result> aggregator = next.getIterationAggregator();
-
-            for (String k : results.keys()) {
-                Result r = aggregator.aggregate(results.get(k));
-                result.put(r.getLabel(), r);
-            }
-        }
-    }
-
-    public Multimap<String, Result> getSubresults() {
-        return results;
-    }
-
-    public Map<String, Double> getScore() {
-        Map<String, Double> r = new TreeMap<String, Double>();
-        for (String k : result.keySet()) {
-            r.put(k, result.get(k).getScore());
-        }
-        return r;
-    }
-
-    public Map<String, Result> getResult() {
-        return result;
-    }
-
-    public String getScoreUnit() {
-        return results.values().iterator().next().getScoreUnit();
-    }
-
-    public String toPrintable() {
-        if (result.size() > 1) {
-            boolean first = true;
-            StringBuilder sb = new StringBuilder();
-            String unit = "";
-            for (Map.Entry<String, Result> res : result.entrySet()) {
-                if (!first) {
-                    sb.append(", ");
-                }
-                first = false;
-
-                // rough estimate
-                int threads = results.get(res.getKey()).size();
-
-                sb.append(res.getKey());
-                sb.append("{t=").append(threads).append("}");
-                sb.append(" = ");
-                sb.append(res.getValue().toPrintableScore());
-
-                unit = res.getValue().getScoreUnit();
-            }
-            sb.append(" ");
-            sb.append(unit);
-            return sb.toString();
-        } else if (result.size() == 1) {
-            return result.values().iterator().next().toString();
-        } else {
-            return "N/A";
-        }
-    }
-}
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 18:41:53 2013 +0400
@@ -24,8 +24,8 @@
  */
 package org.openjdk.jmh.output.format;
 
+import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.logic.results.internal.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -52,15 +52,14 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult result, Collection<ProfilerResult> profiles) {
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
         if (type != IterationType.MEASUREMENT) return;
 
         out.print(name + DELIMITER + iteration + DELIMITER);
-        for (Result r : result.getResult().values()) {
-            out.print(convertDouble(r.getScore()) + DELIMITER);
-        }
-        out.print(params.getThreads() + DELIMITER + result.getScoreUnit() + DELIMITER);
-        for (Result r : result.getSubresults().values()) {
+        out.print(convertDouble(data.getPrimaryResult().getScore()) + DELIMITER);
+        out.print(params.getThreads() + DELIMITER + data.getScoreUnit() + DELIMITER);
+
+        for (Result r : data.getPrimaryResults()) {
             out.print(convertDouble(r.getScore()) + DELIMITER);
         }
         out.println();
@@ -107,10 +106,10 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult results) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
         int count = 0;
 
-        for (Result result : results.getSubresults().values()) {
+        for (Result result : data.getPrimaryResults()) {
             out.print(convertDouble(result.getScore()));
             out.print(DELIMITER);
             count++;
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 18:41:53 2013 +0400
@@ -24,7 +24,7 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.internal.IterationResult;
+import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -59,10 +59,10 @@
      * @param name      name of benchmark
      * @param params
      * @param iteration iteration-number
-     * @param result    result of iteration
+     * @param data    result of iteration
      * @param profiles  profiler results
      */
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult result, Collection<ProfilerResult> profiles);
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles);
 
     /**
      * Format for start-of-benchmark output.
@@ -95,9 +95,9 @@
      * @param name      benchmark name
      * @param params
      * @param iteration iteration number
-     * @param results   AggregatedResults with detailed run results
+     * @param data   AggregatedResults with detailed run results
      */
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult results);
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data);
 
     /* ------------- SPECIAL TRACING METHODS -------------------- */
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 18:41:53 2013 +0400
@@ -24,8 +24,8 @@
  */
 package org.openjdk.jmh.output.format;
 
+import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.logic.results.internal.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -52,8 +52,8 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult result, Collection<ProfilerResult> profiles) {
-        out.print(String.format("%s", result.toPrintable()));
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
+        out.print(String.format("%s", data.toPrintable()));
 
         // also print out profiler information
         if (type == IterationType.MEASUREMENT) {
@@ -153,20 +153,17 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult results) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
         out.print("Results per thread: [");
 
         boolean first = true;
-        Multimap<String, Result> subresults = results.getSubresults();
-        for (String label : subresults.keys()) {
-            for (Result result : subresults.get(label)) {
-                if (!first) {
-                    out.print(", ");
-                }
+        for (Result result : data.getPrimaryResults()) {
+            if (!first) {
+                out.print(", ");
+            }
 
-                out.printf("%.1f", result.getScore());
-                first = false;
-            }
+            out.printf("%.1f", result.getScore());
+            first = false;
         }
 
         out.println("]");
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 18:41:53 2013 +0400
@@ -24,7 +24,7 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.internal.IterationResult;
+import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -64,7 +64,7 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult results) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
 
     }
 
@@ -74,7 +74,7 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult result, Collection<ProfilerResult> profiles) {
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
 
     }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 18:41:53 2013 +0400
@@ -24,8 +24,8 @@
  */
 package org.openjdk.jmh.output.format;
 
+import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.logic.results.internal.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -52,12 +52,12 @@
  */
 public class TextReportFormat extends PrettyPrintFormat {
 
-    private final Multimap<BenchmarkIdentifier, IterationResult> benchmarkResults;
+    private final Multimap<BenchmarkIdentifier, IterationData> benchmarkResults;
     private final Map<BenchmarkRecord, IterationParams> benchmarkSettings;
 
     public TextReportFormat(PrintStream out, boolean verbose) {
         super(out, verbose);
-        benchmarkResults = new TreeMultimap<BenchmarkIdentifier, IterationResult>();
+        benchmarkResults = new TreeMultimap<BenchmarkIdentifier, IterationData>();
         benchmarkSettings = new TreeMap<BenchmarkRecord, IterationParams>();
     }
 
@@ -68,10 +68,10 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult result, Collection<ProfilerResult> profiles) {
-        super.iterationResult(name, params, iteration, type, result, profiles);
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
+        super.iterationResult(name, params, iteration, type, data, profiles);
         if (type == IterationType.MEASUREMENT) {
-            benchmarkResults.put(new BenchmarkIdentifier(name, params.getThreads()), result);
+            benchmarkResults.put(new BenchmarkIdentifier(name, params.getThreads()), data);
         }
     }
 
@@ -88,11 +88,11 @@
 
         Collection<String> benchNames = new ArrayList<String>();
         for (BenchmarkIdentifier key : benchmarkResults.keys()) {
-            Collection<IterationResult> results = benchmarkResults.get(key);
+            Collection<IterationData> results = benchmarkResults.get(key);
             if (results != null) {
                 List<Result> iResults = new ArrayList<Result>();
-                for (IterationResult res : results) {
-                    iResults.addAll(res.getResult().values());
+                for (IterationData res : results) {
+                    iResults.addAll(res.getPrimaryResults());
                 }
 
                 if (!iResults.isEmpty()) {
@@ -123,13 +123,13 @@
             double[] interval = new double[]{Double.NaN, Double.NaN};
 
             IterationParams settings = benchmarkSettings.get(key.benchmark);
-            Collection<IterationResult> results = benchmarkResults.get(key);
+            Collection<IterationData> results = benchmarkResults.get(key);
 
             boolean resultOK = false;
             if (results != null) {
                 List<Result> iResults = new ArrayList<Result>();
-                for (IterationResult res : results) {
-                    iResults.addAll(res.getResult().values());
+                for (IterationData res : results) {
+                    iResults.addAll(res.getPrimaryResults());
                 }
 
                 if (!iResults.isEmpty()) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 18:41:53 2013 +0400
@@ -26,7 +26,6 @@
 
 import org.openjdk.jmh.logic.results.IterationData;
 import org.openjdk.jmh.logic.results.Result;
-import org.openjdk.jmh.logic.results.internal.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.output.format.IterationType;
 import org.openjdk.jmh.output.format.OutputFormat;
@@ -100,8 +99,7 @@
             out.iteration(handler.getBenchmark(), wp, i, IterationType.WARMUP);
             boolean isLastIteration = (executionParams.getIteration().getCount() == 0);
             IterationData iterData = handler.runIteration(wp, isLastIteration);
-            IterationResult iterResult = new IterationResult(iterData.getRawResults());
-            out.iterationResult(handler.getBenchmark(), wp, i, IterationType.WARMUP, iterResult, iterData.getProfilerResults());
+            out.iterationResult(handler.getBenchmark(), wp, i, IterationType.WARMUP, iterData, iterData.getProfilerResults());
         }
 
         // measurement
@@ -122,11 +120,10 @@
             if (iterData.isResultsEmpty()) {
                 out.println("WARNING: No results returned, benchmark payload threw exception?");
             } else {
-                IterationResult iterResult = new IterationResult(iterData.getRawResults());
-                out.iterationResult(handler.getBenchmark(), mp, i, IterationType.MEASUREMENT, iterResult, iterData.getProfilerResults());
+                out.iterationResult(handler.getBenchmark(), mp, i, IterationType.MEASUREMENT, iterData, iterData.getProfilerResults());
 
                 if (options.shouldOutputDetailedResults()) {
-                    out.detailedResults(handler.getBenchmark(), mp, i, iterResult);
+                    out.detailedResults(handler.getBenchmark(), mp, i, iterData);
                 }
 
                 allResults.add(iterData);
@@ -208,8 +205,7 @@
     protected static RunResult aggregateIterationData(List<IterationData> results) {
         List<Result> res = new ArrayList<Result>(results.size());
         for (IterationData itData : results) {
-            IterationResult iterResult = new IterationResult(itData.getRawResults());
-            res.addAll(iterResult.getResult().values());
+            res.add(itData.getPrimaryResult());
         }
         return new RunResult(res);
     }
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 17:31:25 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 18:41:53 2013 +0400
@@ -26,10 +26,10 @@
 
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.openjdk.jmh.logic.results.internal.IterationResult;
-
-import java.util.ArrayList;
-import java.util.List;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.runner.BenchmarkRecord;
+import org.openjdk.jmh.runner.parameters.IterationParams;
+import org.openjdk.jmh.runner.parameters.TimeValue;
 
 import static org.junit.Assert.assertEquals;
 
@@ -41,22 +41,20 @@
  */
 public class TestAggregateResult {
 
-    private static IterationResult result;
+    private static IterationData result;
     private static final double[] values = {10.0, 20.0, 30.0, 40.0, 50.0};
 
     @BeforeClass
     public static void setupClass() {
-        List<Result> results = new ArrayList<Result>();
+        result = new IterationData(new BenchmarkRecord("blah,blah," + Mode.AverageTime), new IterationParams(1, TimeValue.days(1), 1));
         for (double d : values) {
-            results.add(new OpsPerTimeUnit("test1", (long) d, 10 * 1000 * 1000));
+            result.addResult(new OpsPerTimeUnit("test1", (long) d, 10 * 1000 * 1000));
         }
-
-        result = new IterationResult(results);
     }
 
     @Test
     public void testScore() throws Exception {
-        assertEquals(15.0, result.getScore().get("test1"), 0.00001);
+        assertEquals(15.0, result.getPrimaryResult().getScore(), 0.00001);
     }
 
     @Test