changeset 216:24d17973e4b9

Patch the regression in warmup forks, were erroneuosly included into the results.
author shade
date Sat, 26 Oct 2013 10:38:32 +0400
parents 84b34ad28128
children 4660959c5cef
files jmh-core/src/main/java/org/openjdk/jmh/link/BinaryLinkServer.java jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/link/BinaryLinkServer.java	Thu Oct 24 20:07:41 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/link/BinaryLinkServer.java	Sat Oct 26 10:38:32 2013 +0400
@@ -71,6 +71,7 @@
     private final Acceptor acceptor;
     private final List<Handler> registeredHandlers;
     private final Multimap<BenchmarkRecord, BenchResult> results;
+    private volatile boolean ignoreNextResult;
 
     public BinaryLinkServer(Options opts, OutputFormat out) throws IOException {
         this.opts = opts;
@@ -136,6 +137,10 @@
         }
     }
 
+    public void ignoreNextResult() {
+        ignoreNextResult = true;
+    }
+
     private final class Acceptor extends Thread {
 
         private final ServerSocket server;
@@ -246,7 +251,11 @@
 
         private void handleResults(ResultsFrame obj) {
             synchronized (this) {
-                results.put(obj.getRecord(), obj.getResult());
+                if (!ignoreNextResult) {
+                    results.put(obj.getRecord(), obj.getResult());
+                } else {
+                    ignoreNextResult = false;
+                }
             }
         }
 
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Thu Oct 24 20:07:41 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/Runner.java	Sat Oct 26 10:38:32 2013 +0400
@@ -380,11 +380,11 @@
         int forkCount = decideForks(options.getForkCount(), benchForks(benchmark));
         int warmupForkCount = decideWarmupForks(options.getWarmupForkCount(), forkAnnotation);
         if (warmupForkCount > 0) {
-            String[] warmupForkCheat = Utils.concat(commandString, new String[]{"-wi", "1", "-i", "0"});
-            out.verbosePrintln("Warmup forking " + warmupForkCount + " times using command: " + Arrays.toString(warmupForkCheat));
+            out.verbosePrintln("Warmup forking " + warmupForkCount + " times using command: " + Arrays.toString(commandString));
             for (int i = 0; i < warmupForkCount; i++) {
                 out.println("# Warmup Fork: " + (i+1) + " of " + forkCount);
-                doFork(reader, warmupForkCheat);
+                reader.ignoreNextResult();
+                doFork(reader, commandString);
             }
         }