changeset 169:dee7edd4c824

Reuse RunResult.merge in PrettyPrintFormat.
author shade
date Fri, 30 Aug 2013 12:23:22 +0400
parents 48fd68662be4
children df993bf0254c
files jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Thu Aug 29 22:55:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Fri Aug 30 12:23:22 2013 +0400
@@ -33,6 +33,7 @@
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -107,6 +108,10 @@
     }
 
     public static RunResult merge(RunResult... rrs) {
+        return merge(Arrays.asList(rrs));
+    }
+
+    public static RunResult merge(Collection<RunResult> rrs) {
         List<IterationResult> rs = new ArrayList<IterationResult>();
         for (RunResult rr : rrs) {
             if (rr == null) continue;
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Thu Aug 29 22:55:15 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Fri Aug 30 12:23:22 2013 +0400
@@ -147,11 +147,7 @@
             if (forkedResults.size() > 1) {
                 out.println("\"" + key.getUsername() + "\", aggregate over forked runs:");
 
-                List<IterationResult> iResults = new ArrayList<IterationResult>();
-                for (RunResult res : forkedResults) {
-                    iResults.addAll(res.getRawIterationResults());
-                }
-                RunResult runResult = new RunResult(iResults);
+                RunResult runResult = RunResult.merge(forkedResults);
 
                 out.println(runResult.getPrimaryResult().extendedInfo("***"));
                 for (Result r : runResult.getSecondaryResults().values()) {