changeset 323:6819ef0390f3

Enforce the sorted benchmark order (again!).
author shade
date Fri, 13 Dec 2013 20:52:13 +0400
parents 8224248c8e02
children ea37cd23bb90
files jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkList.java jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkList.java	Fri Dec 13 20:47:27 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/MicroBenchmarkList.java	Fri Dec 13 20:52:13 2013 +0400
@@ -33,6 +33,7 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
 
@@ -95,7 +96,7 @@
      * @param excludes List of regexps to match excludes against
      * @return Names of all micro benchmarks in the list that matches includes and NOT matching excludes
      */
-    public Set<BenchmarkRecord> find(OutputFormat out, List<String> regexps, List<String> excludes) {
+    public SortedSet<BenchmarkRecord> find(OutputFormat out, List<String> regexps, List<String> excludes) {
 
         // compile all patterns
         List<Pattern> includePatterns = new ArrayList<Pattern>(regexps.size());
@@ -108,7 +109,7 @@
         }
 
         // find all benchmarks matching pattern
-        Set<BenchmarkRecord> result = new TreeSet<BenchmarkRecord>();
+        SortedSet<BenchmarkRecord> result = new TreeSet<BenchmarkRecord>();
         try {
             for (Reader r : getReaders()) {
                 BufferedReader reader = new BufferedReader(r);
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Fri Dec 13 20:47:27 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Fri Dec 13 20:52:13 2013 +0400
@@ -61,6 +61,7 @@
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
+import java.util.SortedSet;
 import java.util.TreeMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -148,7 +149,7 @@
      * @return map of benchmark results
      */
     public Map<BenchmarkRecord, RunResult> run() throws RunnerException {
-        Set<BenchmarkRecord> benchmarks = list.find(out, options.getIncludes(), options.getExcludes());
+        SortedSet<BenchmarkRecord> benchmarks = list.find(out, options.getIncludes(), options.getExcludes());
 
         if (benchmarks.isEmpty()) {
             out.println("No matching benchmarks. Miss-spelled regexp? Use -v for verbose output.");
@@ -204,7 +205,7 @@
         return results;
     }
 
-    private ActionPlan getEmbeddedActionPlan(Set<BenchmarkRecord> benchmarks) {
+    private ActionPlan getEmbeddedActionPlan(SortedSet<BenchmarkRecord> benchmarks) {
         ActionPlan r = new ActionPlan();
 
         LinkedHashSet<BenchmarkRecord> warmupBenches = new LinkedHashSet<BenchmarkRecord>();
@@ -235,7 +236,7 @@
         return r;
     }
 
-    private Set<ActionPlan> getForkedActionPlans(Set<BenchmarkRecord> benchmarks) {
+    private List<ActionPlan> getForkedActionPlans(Set<BenchmarkRecord> benchmarks) {
         ActionPlan base = new ActionPlan();
 
         LinkedHashSet<BenchmarkRecord> warmupBenches = new LinkedHashSet<BenchmarkRecord>();
@@ -252,7 +253,7 @@
             base.addWarmup(wr);
         }
 
-        Set<ActionPlan> result = new HashSet<ActionPlan>();
+        List<ActionPlan> result = new ArrayList<ActionPlan>();
         for (BenchmarkRecord br : benchmarks) {
             BenchmarkParams params = new BenchmarkParams(options, br, ActionMode.UNDEF);
             if (params.getForks() > 0) {
@@ -270,7 +271,7 @@
         return result;
     }
 
-    private Map<BenchmarkRecord, RunResult> runBenchmarks(Set<BenchmarkRecord> benchmarks) {
+    private Map<BenchmarkRecord, RunResult> runBenchmarks(SortedSet<BenchmarkRecord> benchmarks) {
         out.startRun();
 
         Multimap<BenchmarkRecord, BenchResult> results = new TreeMultimap<BenchmarkRecord, BenchResult>();