changeset 306:5eef9dda8fc7

Do not mix up warmup micros from -wm and -wmb.
author shade
date Thu, 05 Dec 2013 14:30:16 +0400
parents 578b0b6a25d9
children 77875ed7104b
files jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java
diffstat 1 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Thu Dec 05 12:46:39 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Thu Dec 05 14:30:16 2013 +0400
@@ -56,6 +56,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -206,12 +207,18 @@
     private ActionPlan getEmbeddedActionPlan(Set<BenchmarkRecord> benchmarks) {
         ActionPlan r = new ActionPlan();
 
+        LinkedHashSet<BenchmarkRecord> warmupBenches = new LinkedHashSet<BenchmarkRecord>();
+
         List<String> warmupMicrosRegexp = options.getWarmupIncludes();
         if (warmupMicrosRegexp != null && !warmupMicrosRegexp.isEmpty()) {
-            r.addWarmup(list.find(out, warmupMicrosRegexp, Collections.<String>emptyList()));
+            warmupBenches.addAll(list.find(out, warmupMicrosRegexp, Collections.<String>emptyList()));
         }
         if (options.getWarmupMode().isBulk()) {
-            r.addWarmup(benchmarks);
+            warmupBenches.addAll(benchmarks);
+        }
+
+        for (BenchmarkRecord wr : warmupBenches) {
+            r.addWarmup(wr);
         }
 
         for (BenchmarkRecord br : benchmarks) {
@@ -231,12 +238,18 @@
     private Set<ActionPlan> getForkedActionPlans(Set<BenchmarkRecord> benchmarks) {
         ActionPlan base = new ActionPlan();
 
+        LinkedHashSet<BenchmarkRecord> warmupBenches = new LinkedHashSet<BenchmarkRecord>();
+
         List<String> warmupMicrosRegexp = options.getWarmupIncludes();
         if (warmupMicrosRegexp != null && !warmupMicrosRegexp.isEmpty()) {
-            base.addWarmup(list.find(out, warmupMicrosRegexp, Collections.<String>emptyList()));
+            warmupBenches.addAll(list.find(out, warmupMicrosRegexp, Collections.<String>emptyList()));
         }
         if (options.getWarmupMode().isBulk()) {
-            base.addWarmup(benchmarks);
+            warmupBenches.addAll(benchmarks);
+        }
+
+        for (BenchmarkRecord wr : warmupBenches) {
+            base.addWarmup(wr);
         }
 
         Set<ActionPlan> result = new HashSet<ActionPlan>();