changeset 164:e0d0ab023d09

Massive RunResult/IterationData interface cleanups.
author shade
date Thu, 29 Aug 2013 22:11:57 +0400
parents ca3102a6f220
children 5c681b07b50a
files jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationResult.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.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/BaseMicroBenchmarkHandler.java jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandler.java jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java
diffstat 16 files changed, 289 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Thu Aug 29 22:11:57 2013 +0400
@@ -53,19 +53,11 @@
 
         Map<BenchmarkRecord, RunResult> results = new Runner(opts).run();
         RunResult runResult = extractSingleResult(results);
-        Result result = extractSingleMetric(runResult);
+        Result result = runResult.getPrimaryResult();
 
         System.out.println("API replied benchmark score: " + result.getScore() + " " + result.getScoreUnit());
     }
 
-    private static Result extractSingleMetric(RunResult result) {
-        Map<String,Result> results = result.getResults();
-        if (results.size() != 1) {
-            throw new IllegalArgumentException("More than one metric: " + results);
-        }
-        return results.values().iterator().next();
-    }
-
     public static RunResult extractSingleResult(Map<BenchmarkRecord, RunResult> results) {
         if (results.size() != 1) {
             throw new IllegalArgumentException("More than one result: " + results);
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationData.java	Thu Aug 29 20:20:24 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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;
-
-import org.openjdk.jmh.profile.ProfilerResult;
-import org.openjdk.jmh.runner.BenchmarkRecord;
-import org.openjdk.jmh.runner.parameters.IterationParams;
-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.Collection;
-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 implements Serializable {
-
-    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;
-
-    public IterationData(BenchmarkRecord benchmark, IterationParams params) {
-        this.benchmark = benchmark;
-        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 (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 (result.getMode().secondary()) {
-            secondaryResults.put(result.getLabel(), result);
-        }
-    }
-
-    public List<Result> getRawPrimaryResults() {
-        return primaryResults;
-    }
-
-    public Multimap<String, Result> getRawSecondaryResults() {
-        return secondaryResults;
-    }
-
-    public Map<String, Result> getSecondaryResults() {
-        Map<String, Result> answer = new TreeMap<String, Result>();
-        for (String label : secondaryResults.keys()) {
-            Collection<Result> results = secondaryResults.get(label);
-
-            Result next = results.iterator().next();
-
-            @SuppressWarnings("unchecked")
-            Aggregator<Result> aggregator = next.getIterationAggregator();
-            Result result = aggregator.aggregate(results);
-            answer.put(label, result);
-        }
-        return answer;
-    }
-
-    public Result getPrimaryResult() {
-        Result next = primaryResults.iterator().next();
-
-        @SuppressWarnings("unchecked")
-        Aggregator<Result> aggregator = next.getIterationAggregator();
-        return aggregator.aggregate(primaryResults);
-    }
-
-    public boolean isResultsEmpty() {
-        return primaryResults.isEmpty();
-    }
-
-    public void clearResults() {
-        primaryResults.clear();
-    }
-
-    public BenchmarkRecord getBenchmark() {
-        return benchmark;
-    }
-
-    public IterationParams getParams() {
-        return params;
-    }
-
-    public void addProfileResult(ProfilerResult profilerResult) {
-        profilerResults.add(profilerResult);
-    }
-
-    public List<ProfilerResult> getProfilerResults() {
-        return profilerResults;
-    }
-
-    public String getScoreUnit() {
-        return scoreUnit;
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/IterationResult.java	Thu Aug 29 22:11:57 2013 +0400
@@ -0,0 +1,139 @@
+/*
+ * 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;
+
+import org.openjdk.jmh.profile.ProfilerResult;
+import org.openjdk.jmh.runner.BenchmarkRecord;
+import org.openjdk.jmh.runner.parameters.IterationParams;
+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.Collection;
+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 IterationResult implements Serializable {
+
+    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;
+
+    public IterationResult(BenchmarkRecord benchmark, IterationParams params) {
+        this.benchmark = benchmark;
+        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 (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 (result.getMode().secondary()) {
+            secondaryResults.put(result.getLabel(), result);
+        }
+    }
+
+    public Collection<Result> getRawPrimaryResults() {
+        return primaryResults;
+    }
+
+    public Multimap<String, Result> getRawSecondaryResults() {
+        return secondaryResults;
+    }
+
+    public Map<String, Result> getSecondaryResults() {
+        Map<String, Result> answer = new TreeMap<String, Result>();
+        for (String label : secondaryResults.keys()) {
+            Collection<Result> results = secondaryResults.get(label);
+
+            Result next = results.iterator().next();
+
+            @SuppressWarnings("unchecked")
+            Aggregator<Result> aggregator = next.getIterationAggregator();
+            Result result = aggregator.aggregate(results);
+            answer.put(label, result);
+        }
+        return answer;
+    }
+
+    public Result getPrimaryResult() {
+        Result next = primaryResults.iterator().next();
+
+        @SuppressWarnings("unchecked")
+        Aggregator<Result> aggregator = next.getIterationAggregator();
+        return aggregator.aggregate(primaryResults);
+    }
+
+    public boolean isResultsEmpty() {
+        return primaryResults.isEmpty();
+    }
+
+    public void clearResults() {
+        primaryResults.clear();
+    }
+
+    public BenchmarkRecord getBenchmark() {
+        return benchmark;
+    }
+
+    public IterationParams getParams() {
+        return params;
+    }
+
+    public void addProfileResult(ProfilerResult profilerResult) {
+        profilerResults.add(profilerResult);
+    }
+
+    public Collection<ProfilerResult> getProfilerResults() {
+        return profilerResults;
+    }
+
+    public String getScoreUnit() {
+        return scoreUnit;
+    }
+
+}
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/Result.java	Thu Aug 29 22:11:57 2013 +0400
@@ -86,7 +86,7 @@
         return statistics;
     }
 
-    public String extendedInfo() {
+    public String extendedInfo(String label) {
         StringWriter sw = new StringWriter();
         PrintWriter pw = new PrintWriter(sw);
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/SampleTimePerOp.java	Thu Aug 29 22:11:57 2013 +0400
@@ -120,7 +120,7 @@
     }
 
     @Override
-    public String extendedInfo() {
+    public String extendedInfo(String label) {
 
         Statistics stats = new Statistics();
         for (long l : buffer.getSamples()) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Thu Aug 29 22:11:57 2013 +0400
@@ -25,12 +25,16 @@
 package org.openjdk.jmh.logic.results.internal;
 
 import org.openjdk.jmh.logic.results.Aggregator;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.Result;
+import org.openjdk.jmh.util.internal.HashMultimap;
 import org.openjdk.jmh.util.internal.Multimap;
 import org.openjdk.jmh.util.internal.Statistics;
-import org.openjdk.jmh.util.internal.TreeMultimap;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -46,57 +50,82 @@
 
     private static final long serialVersionUID = 6467912427356048369L;
 
-    /** Original list of Result */
-    private final Multimap<String, Result> results;
+    private final Collection<IterationResult> iterationResults;
 
-    /** Aggregated result */
-    private final Map<String, Result> result;
+    public RunResult(Collection<IterationResult> data) {
+        this.iterationResults = data;
+    }
 
-    /**
-     * Constructor
-     *
-     * @param rrs Results from the threads
-     */
-    public RunResult(List<Result> rrs) {
-        if (rrs.isEmpty()) {
-            throw new IllegalArgumentException("Empty lists makes no sense");
-        }
+    public Collection<IterationResult> getRawIterationResults() {
+        return iterationResults;
+    }
 
-
-        this.results = new TreeMultimap<String, Result>();
-        for (Result r : rrs) {
-            results.put(r.getLabel(), r);
-        }
-
-        Result next = rrs.iterator().next();
+    public Result getPrimaryResult() {
+        Result next = iterationResults.iterator().next().getPrimaryResult();
 
         @SuppressWarnings("unchecked")
         Aggregator<Result> aggregator = next.getRunAggregator();
-
-        this.result = new TreeMap<String, Result>();
-        for (String k : results.keys()) {
-            Result r = aggregator.aggregate(results.get(k));
-            result.put(r.getLabel(), r);
-        }
+        return aggregator.aggregate(getRawPrimaryResults());
     }
 
-    /**
-     * Statistics object
-     * @return the Statistics object with score
-     */
-    public Map<String, Statistics> getStatistics() {
-        Map<String, Statistics> r = new TreeMap<String, Statistics>();
-        for (String k : result.keySet()) {
-            r.put(k, result.get(k).getStatistics());
+    public Collection<Result> getRawPrimaryResults() {
+        Collection<Result> rs = new ArrayList<Result>();
+        for (IterationResult k : iterationResults) {
+            rs.add(k.getPrimaryResult());
         }
-        return r;
+        return rs;
     }
 
-    public Map<String, Result> getResults() {
-        return result;
+    public Multimap<String, Result> getRawSecondaryResults() {
+        Multimap<String, Result> rs = new HashMultimap<String, Result>();
+        for (IterationResult k : iterationResults) {
+            for (Map.Entry<String, Result> r : k.getSecondaryResults().entrySet()) {
+                rs.put(r.getKey(), r.getValue());
+            }
+        }
+        return rs;
+    }
+
+    public Map<String, Result> getSecondaryResults() {
+        Multimap<String, Result> rs = getRawSecondaryResults();
+
+        Map<String, Result> answers = new TreeMap<String, Result>();
+        for (String k : rs.keys()) {
+            Collection<Result> results = rs.get(k);
+            Result next = results.iterator().next();
+
+            @SuppressWarnings("unchecked")
+            Aggregator<Result> aggregator = next.getRunAggregator();
+            answers.put(k, aggregator.aggregate(results));
+        }
+
+        return answers;
     }
 
     public String getScoreUnit() {
-        return results.values().iterator().next().getScoreUnit();
+        return getPrimaryResult().getScoreUnit();
+    }
+
+    public Statistics getPrimaryStatistics() {
+        Statistics s = new Statistics();
+        for (IterationResult d : iterationResults) {
+            s.addValue(d.getPrimaryResult().getScore());
+        }
+        return s;
+    }
+
+    public Map<String, Statistics> getSecondaryStatistics() {
+        Map<String, Statistics> answer = new HashMap<String, Statistics>();
+        for (IterationResult d : iterationResults) {
+            for (Map.Entry<String, Result> e : d.getSecondaryResults().entrySet()) {
+                Statistics s = answer.get(e.getKey());
+                if (s == null) {
+                    s = new Statistics();
+                    answer.put(e.getKey(), s);
+                }
+                s.addValue(e.getValue().getScore());
+            }
+        }
+        return answer;
     }
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/CsvFormat.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,16 +24,14 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.logic.results.internal.RunResult;
-import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
 
 import java.io.PrintStream;
-import java.util.Collection;
 
 /**
  * CSV implementation of OutputFormat.
@@ -52,7 +50,7 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult data) {
         if (type != IterationType.MEASUREMENT) return;
 
         out.print(name + DELIMITER + iteration + DELIMITER);
@@ -106,7 +104,7 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult data) {
         int count = 0;
 
         for (Result result : data.getRawPrimaryResults()) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/OutputFormat.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,7 +24,7 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
@@ -60,9 +60,8 @@
      * @param params
      * @param iteration iteration-number
      * @param data    result of iteration
-     * @param profiles  profiler results
      */
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles);
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult data);
 
     /**
      * Format for start-of-benchmark output.
@@ -97,7 +96,7 @@
      * @param iteration iteration number
      * @param data   AggregatedResults with detailed run results
      */
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data);
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult data);
 
     /* ------------- SPECIAL TRACING METHODS -------------------- */
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,7 +24,7 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.profile.ProfilerResult;
@@ -53,7 +53,7 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult data) {
         StringBuilder sb = new StringBuilder();
         sb.append(data.getPrimaryResult().toString());
 
@@ -82,7 +82,7 @@
         // also print out profiler information
         if (type == IterationType.MEASUREMENT) {
             boolean firstProfiler = true;
-            for (ProfilerResult profRes : profiles) {
+            for (ProfilerResult profRes : data.getProfilerResults()) {
                 if (profRes.hasData()) {
                     if (firstProfiler) {
                         out.println("");
@@ -128,8 +128,9 @@
         benchmarkResults.put(name, result);
 
         out.println();
-        for (Result r : result.getResults().values()) {
-            out.println(r.extendedInfo());
+        out.println(result.getPrimaryResult().extendedInfo("***"));
+        for (Result r : result.getSecondaryResults().values()) {
+            out.println(r.extendedInfo(r.getLabel()));
         }
         out.println();
     }
@@ -146,14 +147,15 @@
             if (forkedResults.size() > 1) {
                 out.println("\"" + key.getUsername() + "\", aggregate over forked runs:");
 
-                List<Result> iResults = new ArrayList<Result>();
+                List<IterationResult> iResults = new ArrayList<IterationResult>();
                 for (RunResult res : forkedResults) {
-                    iResults.addAll(res.getResults().values());
+                    iResults.addAll(res.getRawIterationResults());
                 }
                 RunResult runResult = new RunResult(iResults);
 
-                for (Result r : runResult.getResults().values()) {
-                    out.println(r.extendedInfo());
+                out.println(runResult.getPrimaryResult().extendedInfo("***"));
+                for (Result r : runResult.getSecondaryResults().values()) {
+                    out.println(r.extendedInfo(r.getLabel()));
                 }
             }
         }
@@ -177,7 +179,7 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult data) {
         out.print("Results per thread: [");
 
         boolean first = true;
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/SilentFormat.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,15 +24,13 @@
  */
 package org.openjdk.jmh.output.format;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
-import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
 
 import java.io.PrintStream;
-import java.util.Collection;
 
 /**
  * Silent format, does nothing.
@@ -64,7 +62,7 @@
     }
 
     @Override
-    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationData data) {
+    public void detailedResults(BenchmarkRecord name, IterationParams params, int iteration, IterationResult data) {
 
     }
 
@@ -74,7 +72,7 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult data) {
 
     }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,10 +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.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
-import org.openjdk.jmh.profile.ProfilerResult;
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.parameters.BenchmarkParams;
 import org.openjdk.jmh.runner.parameters.IterationParams;
@@ -39,7 +37,6 @@
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.TimeUnit;
@@ -52,12 +49,12 @@
  */
 public class TextReportFormat extends PrettyPrintFormat {
 
-    private final Multimap<BenchmarkIdentifier, IterationData> benchmarkResults;
+    private final Multimap<BenchmarkIdentifier, IterationResult> benchmarkResults;
     private final Map<BenchmarkRecord, IterationParams> benchmarkSettings;
 
     public TextReportFormat(PrintStream out, boolean verbose) {
         super(out, verbose);
-        benchmarkResults = new TreeMultimap<BenchmarkIdentifier, IterationData>();
+        benchmarkResults = new TreeMultimap<BenchmarkIdentifier, IterationResult>();
         benchmarkSettings = new TreeMap<BenchmarkRecord, IterationParams>();
     }
 
@@ -68,8 +65,8 @@
     }
 
     @Override
-    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationData data, Collection<ProfilerResult> profiles) {
-        super.iterationResult(name, params, iteration, type, data, profiles);
+    public void iterationResult(BenchmarkRecord name, IterationParams params, int iteration, IterationType type, IterationResult data) {
+        super.iterationResult(name, params, iteration, type, data);
         if (type == IterationType.MEASUREMENT) {
             benchmarkResults.put(new BenchmarkIdentifier(name, params.getThreads()), data);
         }
@@ -88,20 +85,13 @@
 
         Collection<String> benchNames = new ArrayList<String>();
         for (BenchmarkIdentifier key : benchmarkResults.keys()) {
-            Collection<IterationData> results = benchmarkResults.get(key);
-            if (results != null) {
-                List<Result> iResults = new ArrayList<Result>();
-                for (IterationData res : results) {
-                    iResults.addAll(res.getRawPrimaryResults());
-                }
+            Collection<IterationResult> results = benchmarkResults.get(key);
+            if (results != null && !results.isEmpty()) {
+                RunResult runResult = new RunResult(results);
 
-                if (!iResults.isEmpty()) {
-                    RunResult runResult = new RunResult(iResults);
-
-                    boolean onlyResult = runResult.getStatistics().size() <= 1;
-                    for (String label : runResult.getStatistics().keySet()) {
-                        benchNames.add(key.benchmark.getUsername() + (onlyResult ? "" : ":" + label));
-                    }
+                benchNames.add(key.benchmark.getUsername());
+                for (String label : runResult.getSecondaryResults().keySet()) {
+                    benchNames.add(key.benchmark.getUsername() + ":" + label);
                 }
             }
         }
@@ -123,38 +113,41 @@
             double[] interval = new double[]{Double.NaN, Double.NaN};
 
             IterationParams settings = benchmarkSettings.get(key.benchmark);
-            Collection<IterationData> results = benchmarkResults.get(key);
+            Collection<IterationResult> results = benchmarkResults.get(key);
 
-            boolean resultOK = false;
-            if (results != null) {
-                List<Result> iResults = new ArrayList<Result>();
-                for (IterationData res : results) {
-                    iResults.addAll(res.getRawPrimaryResults());
+            if (results != null && !results.isEmpty()) {
+                RunResult runResult = new RunResult(results);
+
+                {
+                    Statistics stats = runResult.getPrimaryStatistics();
+                    if (stats.getN() > 2) {
+                        interval = stats.getConfidenceInterval(0.01);
+                    }
+
+                    out.printf("%-" + nameLen + "s %6s %3d %6d %4d %12.3f %12.3f %8s%n",
+                            benchPrefixes.get(key.benchmark.getUsername()),
+                            key.benchmark.getMode().shortLabel(),
+                            key.threads, stats.getN(),
+                            settings.getTime().convertTo(TimeUnit.SECONDS),
+                            stats.getMean(), (interval[1] - interval[0]) / 2,
+                            runResult.getScoreUnit());
                 }
 
-                if (!iResults.isEmpty()) {
-                    RunResult runResult = new RunResult(iResults);
+                for (String label : runResult.getSecondaryStatistics().keySet()) {
+                    Statistics stats = runResult.getSecondaryStatistics().get(label);
+                    if (stats.getN() > 2) {
+                        interval = stats.getConfidenceInterval(0.01);
+                    }
 
-                    boolean onlyResult = runResult.getStatistics().size() <= 1;
-                    for (String label : runResult.getStatistics().keySet()) {
-                        Statistics stats = runResult.getStatistics().get(label);
-                        if (stats.getN() > 2) {
-                            interval = stats.getConfidenceInterval(0.01);
-                        }
-
-                        out.printf("%-" + nameLen + "s %6s %3d %6d %4d %12.3f %12.3f %8s%n",
-                                benchPrefixes.get(key.benchmark.getUsername() + (onlyResult ? "" : ":" + label)),
-                                key.benchmark.getMode().shortLabel(),
-                                key.threads, stats.getN(),
-                                settings.getTime().convertTo(TimeUnit.SECONDS),
-                                stats.getMean(), (interval[1] - interval[0]) / 2,
-                                runResult.getScoreUnit());
-                    }
-                    resultOK = true;
+                    out.printf("%-" + nameLen + "s %6s %3d %6d %4d %12.3f %12.3f %8s%n",
+                            benchPrefixes.get(key.benchmark.getUsername() + ":" + label),
+                            key.benchmark.getMode().shortLabel(),
+                            key.threads, stats.getN(),
+                            settings.getTime().convertTo(TimeUnit.SECONDS),
+                            stats.getMean(), (interval[1] - interval[0]) / 2,
+                            runResult.getScoreUnit());
                 }
-            }
-
-            if (!resultOK) {
+            } else {
                 out.printf("%-" + nameLen + "s %6s, %3d %6d %4d %12.3f %12.3f %8s%n",
                         benchPrefixes.get(key.benchmark.getUsername()),
                         key.benchmark.getMode().shortLabel(),
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseMicroBenchmarkHandler.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,7 +24,7 @@
  */
 package org.openjdk.jmh.runner;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.profile.Profiler;
 import org.openjdk.jmh.profile.ProfilerType;
@@ -187,7 +187,7 @@
         }
     }
 
-    protected void stopProfilers(IterationData iterationResults) {
+    protected void stopProfilers(IterationResult iterationResults) {
         // stop profilers
         for (Profiler prof : registeredProfilers) {
             try {
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BaseRunner.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,8 +24,7 @@
  */
 package org.openjdk.jmh.runner;
 
-import org.openjdk.jmh.logic.results.IterationData;
-import org.openjdk.jmh.logic.results.Result;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.internal.RunResult;
 import org.openjdk.jmh.output.format.IterationType;
 import org.openjdk.jmh.output.format.OutputFormat;
@@ -84,7 +83,7 @@
     }
 
     protected RunResult runBenchmark(BenchmarkParams executionParams, MicroBenchmarkHandler handler) {
-        List<IterationData> allResults = new ArrayList<IterationData>();
+        List<IterationResult> allResults = new ArrayList<IterationResult>();
 
         out.startBenchmark(handler.getBenchmark(), executionParams, this.options.isVerbose());
 
@@ -98,8 +97,8 @@
 
             out.iteration(handler.getBenchmark(), wp, i, IterationType.WARMUP);
             boolean isLastIteration = (executionParams.getIteration().getCount() == 0);
-            IterationData iterData = handler.runIteration(wp, isLastIteration);
-            out.iterationResult(handler.getBenchmark(), wp, i, IterationType.WARMUP, iterData, iterData.getProfilerResults());
+            IterationResult iterData = handler.runIteration(wp, isLastIteration);
+            out.iterationResult(handler.getBenchmark(), wp, i, IterationType.WARMUP, iterData);
         }
 
         // measurement
@@ -114,13 +113,13 @@
             out.iteration(handler.getBenchmark(), mp, i, IterationType.MEASUREMENT);
 
             boolean isLastIteration = (i == mp.getCount());
-            IterationData iterData = handler.runIteration(mp, isLastIteration);
+            IterationResult iterData = handler.runIteration(mp, isLastIteration);
 
             // might get an exception above, in which case the results list will be empty
             if (iterData.isResultsEmpty()) {
                 out.println("WARNING: No results returned, benchmark payload threw exception?");
             } else {
-                out.iterationResult(handler.getBenchmark(), mp, i, IterationType.MEASUREMENT, iterData, iterData.getProfilerResults());
+                out.iterationResult(handler.getBenchmark(), mp, i, IterationType.MEASUREMENT, iterData);
 
                 if (options.shouldOutputDetailedResults()) {
                     out.detailedResults(handler.getBenchmark(), mp, i, iterData);
@@ -132,7 +131,7 @@
 
         // only print end-of-run output if we have actual results
         if (!allResults.isEmpty()) {
-            RunResult result = aggregateIterationData(allResults);
+            RunResult result = new RunResult(allResults);
             out.endBenchmark(handler.getBenchmark(), result);
             return result;
         } else {
@@ -202,12 +201,4 @@
         return false;
     }
 
-    protected static RunResult aggregateIterationData(List<IterationData> results) {
-        List<Result> res = new ArrayList<Result>(results.size());
-        for (IterationData itData : results) {
-            res.add(itData.getPrimaryResult());
-        }
-        return new RunResult(res);
-    }
-
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopMicroBenchmarkHandler.java	Thu Aug 29 22:11:57 2013 +0400
@@ -27,7 +27,7 @@
 
 import org.openjdk.jmh.annotations.Mode;
 import org.openjdk.jmh.logic.InfraControl;
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.logic.results.Result;
 import org.openjdk.jmh.output.format.OutputFormat;
 import org.openjdk.jmh.runner.options.Options;
@@ -72,7 +72,7 @@
      * {@inheritDoc}
      */
     @Override
-    public IterationData runIteration(IterationParams params, boolean last) {
+    public IterationResult runIteration(IterationParams params, boolean last) {
         int numThreads = params.getThreads();
         TimeValue runtime = params.getTime();
 
@@ -80,7 +80,7 @@
         CountDownLatch preTearDownBarrier = new CountDownLatch(numThreads);
 
         // result object to accumulate the results in
-        IterationData iterationResults = new IterationData(microbenchmark, params);
+        IterationResult iterationResults = new IterationResult(microbenchmark, params);
 
         InfraControl control = new InfraControl(numThreads, shouldSynchIterations, runtime, preSetupBarrier, preTearDownBarrier, last, timeUnit);
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandler.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkHandler.java	Thu Aug 29 22:11:57 2013 +0400
@@ -24,9 +24,8 @@
  */
 package org.openjdk.jmh.runner;
 
-import org.openjdk.jmh.logic.results.IterationData;
+import org.openjdk.jmh.logic.results.IterationResult;
 import org.openjdk.jmh.runner.parameters.IterationParams;
-import org.openjdk.jmh.runner.parameters.TimeValue;
 
 /**
  * Handler for a single micro benchmark. Handles name and execution information (# iterations, et c). Executes the
@@ -44,9 +43,9 @@
      *
      * @param params  Iteration parameters
      * @param last    Should this iteration considered to be the last
-     * @return IterationData
+     * @return IterationResult
      */
-    public IterationData runIteration(IterationParams params, boolean last);
+    public IterationResult runIteration(IterationParams params, boolean last);
 
     /**
      * Do required shutdown actions. Actions may be:
--- a/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 20:20:24 2013 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/logic/results/TestAggregateResult.java	Thu Aug 29 22:11:57 2013 +0400
@@ -41,12 +41,12 @@
  */
 public class TestAggregateResult {
 
-    private static IterationData result;
+    private static IterationResult result;
     private static final double[] values = {10.0, 20.0, 30.0, 40.0, 50.0};
 
     @BeforeClass
     public static void setupClass() {
-        result = new IterationData(new BenchmarkRecord("blah,blah," + Mode.AverageTime), new IterationParams(1, TimeValue.days(1), 1));
+        result = new IterationResult(new BenchmarkRecord("blah,blah," + Mode.AverageTime), new IterationParams(1, TimeValue.days(1), 1));
         for (double d : values) {
             result.addResult(new OpsPerTimeUnit(ResultRole.BOTH, "test1", (long) d, 10 * 1000 * 1000));
         }