changeset 100:1f2690d966ec

Regression: show the aggregates over the forked runs again.
author shade
date Fri, 12 Jul 2013 00:18:10 +0400
parents 7385f6cf96be
children 8046f2c4fce7
files jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java
diffstat 2 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Sat Jul 06 23:17:38 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/PrettyPrintFormat.java	Fri Jul 12 00:18:10 2013 +0400
@@ -31,9 +31,9 @@
 import org.openjdk.jmh.runner.BenchmarkRecord;
 import org.openjdk.jmh.runner.parameters.MicroBenchmarkParameters;
 import org.openjdk.jmh.runner.parameters.TimeValue;
-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.PrintStream;
 import java.util.ArrayList;
@@ -102,7 +102,7 @@
         out.println("# Running: " + name.getUsername());
     }
 
-    private final Multimap<BenchmarkRecord, RunResult> benchmarkResults = new HashMultimap<BenchmarkRecord, RunResult>();
+    private final Multimap<BenchmarkRecord, RunResult> benchmarkResults = new TreeMultimap<BenchmarkRecord, RunResult>();
 
     @Override
     public void endBenchmark(BenchmarkRecord name, RunResult result) {
@@ -125,7 +125,7 @@
         for (BenchmarkRecord key : benchmarkResults.keys()) {
             Collection<RunResult> forkedResults = benchmarkResults.get(key);
             if (forkedResults.size() > 1) {
-                out.println(key + ", aggregate over forked runs:");
+                out.println("\"" + key.getUsername() + "\", aggregate over forked runs:");
 
                 List<Result> iResults = new ArrayList<Result>();
                 for (RunResult res : forkedResults) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java	Sat Jul 06 23:17:38 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/BenchmarkRecord.java	Fri Jul 12 00:18:10 2013 +0400
@@ -70,6 +70,26 @@
         return userName.compareTo(o.userName);
     }
 
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BenchmarkRecord that = (BenchmarkRecord) o;
+
+        if (mode != that.mode) return false;
+        if (!userName.equals(that.userName)) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = userName.hashCode();
+        result = 31 * result + mode.hashCode();
+        return result;
+    }
+
     public String generatedTarget(Mode type) {
         if (mode != Mode.Legacy) {
             return generatedName + "_" + type;