changeset 936:5d6eee917c11

runners: SingleShot mode should not sleep in control thread for run time.
author shade
date Sun, 03 Aug 2014 19:48:27 +0400
parents 6354acecccb7
children 1eff4c9d1ab0
files jmh-core/src/main/java/org/openjdk/jmh/runner/LoopBenchmarkHandler.java
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopBenchmarkHandler.java	Tue Jul 29 10:01:18 2014 -0700
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/LoopBenchmarkHandler.java	Sun Aug 03 19:48:27 2014 +0400
@@ -101,10 +101,16 @@
         }
 
         // wait for the iteration time to expire
-        try {
-            runtime.sleep();
-        } catch (InterruptedException e) {
-            // regardless...
+        switch (benchmarkParams.getMode()) {
+            case SingleShotTime:
+                // don't wait here, block on timed result Future
+                break;
+            default:
+                try {
+                    runtime.sleep();
+                } catch (InterruptedException e) {
+                    // regardless...
+                }
         }
 
         // now we communicate all worker threads should stop