changeset 231:1e942a732f11

Optimize test runner: remove unnecessary postConsume work.
author shade
date Tue, 10 May 2016 20:54:44 +0300
parents f6734c9839bc
children 8ee502de85b3
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java
diffstat 2 files changed, 2 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Tue May 10 20:07:18 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Tue May 10 20:54:44 2016 +0300
@@ -474,8 +474,6 @@
             pw.println("                while (curEpoch != ep.get()) {");
             pw.println("                    if (yield) Thread.yield();");
             pw.println("                }");
-            pw.println();
-            pw.println("                holder.postConsume(yield);");
             pw.println("            }");
             pw.println("        }");
             n++;
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java	Tue May 10 20:07:18 2016 +0300
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/runners/StateHolder.java	Tue May 10 20:54:44 2016 +0300
@@ -33,8 +33,8 @@
     public final boolean stopped;
     public final P[] pairs;
     public final int countWorkers;
-    public final AtomicInteger started, ready, finished, consumed;
-    public volatile boolean notAllStarted, notAllReady, notAllFinished, notAllConsumed;
+    public final AtomicInteger started, ready, finished;
+    public volatile boolean notAllStarted, notAllReady, notAllFinished;
     public volatile boolean hasLaggedWorkers;
 
     public StateHolder(boolean stopped, P[] pairs, int expectedWorkers) {
@@ -44,11 +44,9 @@
         this.ready = new AtomicInteger(expectedWorkers);
         this.started = new AtomicInteger(expectedWorkers);
         this.finished = new AtomicInteger(expectedWorkers);
-        this.consumed = new AtomicInteger(expectedWorkers);
         this.notAllReady = true;
         this.notAllFinished = true;
         this.notAllStarted = true;
-        this.notAllConsumed = true;
     }
 
     public void preRun(boolean shouldYield) {
@@ -79,13 +77,4 @@
         }
     }
 
-    public void postConsume(boolean shouldYield) {
-        if (consumed.decrementAndGet() == 0) {
-            notAllConsumed = false;
-        }
-        while (notAllConsumed) {
-            if (shouldYield) Thread.yield();
-        }
-    }
-
 }