From efc2fea4b54a68f8f3c7a7e1ae79f5394cc64833 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Thu, 26 Jun 2014 14:54:01 +0200 Subject: [PATCH] added do/while to pipeline --- .../framework/core/Pipeline.java | 18 +++++++++++++----- .../MethodCallThroughputAnalysis15.java | 1 + src/test/java/what tests work.txt | 17 ----------------- 3 files changed, 14 insertions(+), 22 deletions(-) delete mode 100644 src/test/java/what tests work.txt diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java index 596dce3f..25667aeb 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java @@ -31,6 +31,8 @@ public class Pipeline<I, O> implements StageWithPort<I, O> { private boolean reschedulable; private int firstStageIndex; + // private final Set<StageWithPort<?, ?>> currentHeads = new HashSet<StageWithPort<?, ?>>(); + public Pipeline() { this.id = UUID.randomUUID().toString(); // the id should only be represented by a UUID, not additionally by the class name this.logger = LogFactory.getLog(this.id); @@ -80,16 +82,23 @@ public class Pipeline<I, O> implements StageWithPort<I, O> { @Override public void executeWithPorts() { this.logger.debug("Executing stage..."); - StageWithPort<?, ?> firstStage = this.stages[this.firstStageIndex]; - firstStage.executeWithPorts(); - this.updateRescheduable(firstStage); - // this.setReschedulable(stage.isReschedulable()); + // StageWithPort<?, ?> headStage = this.currentHeads.next(); + StageWithPort<?, ?> headStage = this.stages[this.firstStageIndex]; + + do { + headStage.executeWithPorts(); + } while (headStage.isReschedulable()); + + this.updateRescheduable(headStage); } private final void updateRescheduable(final StageWithPort<?, ?> stage) { StageWithPort<?, ?> currentStage = stage; while (!currentStage.isReschedulable()) { + // this.currentHeads.remove(currentStage); + // this.currentHeads.addAll(currentStage.getOutputPorts()); + this.firstStageIndex++; // currentStage = currentStage.getOutputPort().getPipe().getTargetStage(); // FIXME what to do with a stage with more than one output port? // if (currentStage == null) { // loop reaches the last stage @@ -100,7 +109,6 @@ public class Pipeline<I, O> implements StageWithPort<I, O> { } currentStage = this.stages[this.firstStageIndex]; currentStage.onIsPipelineHead(); - // System.out.println("firstStageIndex: " + this.firstStageIndex + ", class:" + stage.getClass().getSimpleName()); } this.setReschedulable(true); } diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java index 134d80ae..0601e70c 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java +++ b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java @@ -40,6 +40,7 @@ import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; * @since 1.10 */ public class MethodCallThroughputAnalysis15 extends Analysis { + // FIXME this analysis sometimes runs infinitely private static final int SPSC_INITIAL_CAPACITY = 4; diff --git a/src/test/java/what tests work.txt b/src/test/java/what tests work.txt deleted file mode 100644 index 5a29be3e..00000000 --- a/src/test/java/what tests work.txt +++ /dev/null @@ -1,17 +0,0 @@ -ok -no -inf -inf -inf -no -no -no - - -ok -no - - - - - -- GitLab