diff --git a/src/main/java/teetime/framework/AbstractStage.java b/src/main/java/teetime/framework/AbstractStage.java index 6dc10ce0509efdc690dd58a16d8fa064e78b64e4..804982742d2a63bba3e564ee2df314ff010c215e 100644 --- a/src/main/java/teetime/framework/AbstractStage.java +++ b/src/main/java/teetime/framework/AbstractStage.java @@ -12,6 +12,8 @@ import teetime.framework.validation.InvalidPortConnection; public abstract class AbstractStage extends Stage { + private static final IPipe DUMMY_PORT = new DummyPipe(); + private final List<InputPort<?>> inputPortList = new ArrayList<InputPort<?>>(); private final List<OutputPort<?>> outputPortList = new ArrayList<OutputPort<?>>(); @@ -84,6 +86,7 @@ public abstract class AbstractStage extends Stage { } public void onStarting() throws Exception { + this.owningThread = Thread.currentThread(); this.cachedInputPorts = this.inputPortList.toArray(new InputPort<?>[0]); this.cachedOutputPorts = this.outputPortList.toArray(new OutputPort<?>[0]); @@ -97,7 +100,7 @@ public abstract class AbstractStage extends Stage { for (OutputPort<?> outputPort : this.cachedOutputPorts) { if (null == outputPort.getPipe()) { // if port is unconnected this.logger.warn("Unconnected output port: " + outputPort + ". Connecting with a dummy output port."); - outputPort.setPipe(new DummyPipe()); + outputPort.setPipe(DUMMY_PORT); } } } diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/Stage.java index 6c13ebdda92f37f4d70076ed2fa6e8f981cf0fd0..0d0b82c5ca34033eb60b67861c952c0b846bc402 100644 --- a/src/main/java/teetime/framework/Stage.java +++ b/src/main/java/teetime/framework/Stage.java @@ -27,7 +27,8 @@ public abstract class Stage { @SuppressWarnings("PMD.LoggerIsNotStaticFinal") protected final Logger logger; - private Thread owningThread; + /** The owning thread of this stage if this stage is directly executed by a {@link RunnableStage}, <code>null</code> otherwise. */ + protected Thread owningThread; protected Stage() { this.id = this.createId(); @@ -94,11 +95,12 @@ public abstract class Stage { return owningThread; } - public void setOwningThread(final Thread owningThread) { + void setOwningThread(final Thread owningThread) { this.owningThread = owningThread; } protected abstract InputPort<?>[] getInputPorts(); protected abstract boolean isStarted(); + } diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java index 369326fc8cdf85b8b1d147b0210d03ff72e06be6..0e90896601abfda319d7790fba9989927f10cffa 100644 --- a/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java @@ -37,7 +37,7 @@ class ChwHomePerformanceCheck extends AbstractPerformanceCheck { // since 04.11.2014 (incl.) // assertEquals(71, medianSpeedup, 2.1); // +27 // since 05.12.2014 (incl.) - assertEquals(45, medianSpeedup, 2.1); // -26 (45-56) + assertEquals(43, medianSpeedup, 2.1); // -28 (41-56) } private void checkSingleElementPipes() { diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java index b4f1bcbc237021798b7ac326038cfeed3ababc55..eba54e13f3b6d62eead71a126504e5232e5556d9 100644 --- a/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java @@ -17,12 +17,14 @@ package teetime.examples.experiment09pipeimpls; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import teetime.framework.pipe.CommittablePipeFactory; import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.OrderedGrowableArrayPipeFactory; import teetime.framework.pipe.SingleElementPipeFactory; +import teetime.framework.pipe.UnorderedGrowablePipeFactory; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.AbstractProfiledPerformanceAssertion; @@ -65,6 +67,13 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { testWithManyObjects(pipeFactory); } + @Ignore + @Test + public void testUnorderedGrowablePipes() throws Exception { // TODO remove test 11 + IPipeFactory pipeFactory = new UnorderedGrowablePipeFactory(); + testWithManyObjects(pipeFactory); + } + private void testWithManyObjects(final IPipeFactory pipeFactory) { System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" + NUM_NOOP_FILTERS + "..."); diff --git a/src/performancetest/java/teetime/framework/OldPipeline.java b/src/performancetest/java/teetime/framework/OldPipeline.java index 3ee0a72a15b0adf7dae5839e77602e16c6792189..7d24233ed21bf1919bb639491fc34c587cb04aab 100644 --- a/src/performancetest/java/teetime/framework/OldPipeline.java +++ b/src/performancetest/java/teetime/framework/OldPipeline.java @@ -57,11 +57,6 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> exte return firstStage.getInputPorts(); } - @Override - public void setOwningThread(final Thread owningThread) { - firstStage.setOwningThread(owningThread); - } - @Override public Thread getOwningThread() { return firstStage.getOwningThread();