changeset 29:31111172517a

Fix yielding on low CPU machines, also cover the user-supplied thread count.
author shade
date Wed, 24 Jul 2013 12:37:39 +0400
parents 6d9c5bd295d1
children 39879befac76
files harness/src/main/java/org/openjdk/jcstress/Options.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/harness/src/main/java/org/openjdk/jcstress/Options.java	Wed Jul 24 12:33:08 2013 +0400
+++ b/harness/src/main/java/org/openjdk/jcstress/Options.java	Wed Jul 24 12:37:39 2013 +0400
@@ -46,6 +46,9 @@
 public class Options {
     public static final String STATE_FILE = "test.state";
 
+    // the largest test it 4 threads wide
+    private static final int MIN_THREADS = 4;
+
     private String resultDir;
     private String testFilter;
     private int minStride, maxStride;
@@ -172,10 +175,11 @@
         }
 
         if (!set.hasArgument(cpus)) {
-            this.userCPUs = Math.max(4, this.systemCPUs);
+            this.userCPUs = this.systemCPUs;
         } else {
             this.userCPUs = set.valueOf(cpus);
         }
+        this.userCPUs = Math.max(MIN_THREADS, this.userCPUs);
 
         if (userCPUs > systemCPUs) {
             forceYield = true;