diff --git a/src/main/java/teetime/framework/AbstractInterThreadPipe.java b/src/main/java/teetime/framework/AbstractInterThreadPipe.java index 5471576ba9def3c1a59caa923df4237d2495559b..5b11b35fd6ef1cab297780ede1512a526a0dc58b 100644 --- a/src/main/java/teetime/framework/AbstractInterThreadPipe.java +++ b/src/main/java/teetime/framework/AbstractInterThreadPipe.java @@ -23,13 +23,17 @@ public abstract class AbstractInterThreadPipe extends AbstractPipe { this.signalQueue.offer(signal); Thread owningThread = cachedTargetStage.getOwningThread(); + if (owningThread == null) { + System.err.println("cachedTargetStage: " + cachedTargetStage); + } if (null != owningThread && isThreadWaiting(owningThread)) { // FIXME remove the null check for performance owningThread.interrupt(); } } - protected boolean isThreadWaiting(final Thread thread) { - return thread.getState() == State.WAITING || thread.getState() == State.TIMED_WAITING; + protected final boolean isThreadWaiting(final Thread thread) { + final State state = thread.getState(); // store state in variable for performance reasons + return state == State.WAITING || state == State.TIMED_WAITING; } /** diff --git a/src/main/java/teetime/framework/AbstractIntraThreadPipe.java b/src/main/java/teetime/framework/AbstractIntraThreadPipe.java index 416a0d6da7edfa9f369fd01df5ca2a1b4624cc6f..4577b1352ff3d1c1a8d79b96e609b3427df5e0b1 100644 --- a/src/main/java/teetime/framework/AbstractIntraThreadPipe.java +++ b/src/main/java/teetime/framework/AbstractIntraThreadPipe.java @@ -10,9 +10,8 @@ public abstract class AbstractIntraThreadPipe extends AbstractPipe { @Override public final void sendSignal(final ISignal signal) { - // if (this.getTargetPort() != null) { // BETTER remove this check since there are DummyPorts + // getTargetPort is always non-null since the framework adds dummy ports if necessary this.cachedTargetStage.onSignal(signal, this.getTargetPort()); - // } } @Override 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/RunnableConsumerStage.java b/src/main/java/teetime/framework/RunnableConsumerStage.java index 655e0f82f95214cdb6d4c0aff27309e3d08fd687..a68b31024fd013d3e3c4e2fdf613a6fe794c4f83 100644 --- a/src/main/java/teetime/framework/RunnableConsumerStage.java +++ b/src/main/java/teetime/framework/RunnableConsumerStage.java @@ -11,6 +11,12 @@ final class RunnableConsumerStage extends RunnableStage { private final IdleStrategy idleStrategy; + /** + * Creates a new instance with the {@link YieldStrategy} as default idle strategy. + * + * @param stage + * to execute within an own thread + */ public RunnableConsumerStage(final Stage stage) { this(stage, new YieldStrategy()); } 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/main/java/teetime/framework/pipe/CommittablePipeFactory.java b/src/main/java/teetime/framework/pipe/CommittablePipeFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..93b054e625686c339648d1f15ec0a5831a87321d --- /dev/null +++ b/src/main/java/teetime/framework/pipe/CommittablePipeFactory.java @@ -0,0 +1,35 @@ +package teetime.framework.pipe; + +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; +import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; + +public class CommittablePipeFactory implements IPipeFactory { + + @Override + public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { + return this.create(sourcePort, targetPort, 1); + } + + @Override + public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) { + return new CommittablePipe(sourcePort, targetPort); + } + + @Override + public ThreadCommunication getThreadCommunication() { + return ThreadCommunication.INTRA; + } + + @Override + public PipeOrdering getOrdering() { + return PipeOrdering.STACK_BASED; + } + + @Override + public boolean isGrowable() { + return true; + } + +} diff --git a/src/main/java/util/MooBenchStarter.java b/src/main/java/util/MooBenchStarter.java deleted file mode 100644 index 6d2253022d0d7df3a5fd2769eba517199764038d..0000000000000000000000000000000000000000 --- a/src/main/java/util/MooBenchStarter.java +++ /dev/null @@ -1,31 +0,0 @@ -package util; - -import java.io.File; -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; - -public class MooBenchStarter { - - private final File execDir; - - public MooBenchStarter() { - this.execDir = new File("scripts/MooBench-cmd"); - System.out.println("execDir: " + this.execDir.getAbsolutePath()); - } - - public void start(final int runs, final long calls) throws IOException { - final List<String> command = new LinkedList<String>(); - command.add("cmd"); - command.add("/c"); - command.add("start"); - command.add("/D"); - command.add(this.execDir.getAbsolutePath()); - command.add("Load Driver"); - command.add("startMooBench.cmd"); - command.add(String.valueOf(runs)); - command.add(String.valueOf(calls)); - - new ProcessBuilder(command).start(); - } -} diff --git a/src/main/java/util/test/PerformanceCheckProfileRepository.java b/src/main/java/util/test/PerformanceCheckProfileRepository.java index 603587585034c4b8453d14f77935c6dd271331c6..3ff5d8ca541740e1259f0062e905c7cafacc3968 100644 --- a/src/main/java/util/test/PerformanceCheckProfileRepository.java +++ b/src/main/java/util/test/PerformanceCheckProfileRepository.java @@ -1,5 +1,7 @@ package util.test; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.HashMap; import java.util.Map; @@ -16,10 +18,26 @@ public class PerformanceCheckProfileRepository { private String currentProfile; public PerformanceCheckProfileRepository() { - this.currentProfile = System.getProperty("TestProfile", "ChwWork"); + String hostName = getHostName(); + // this.currentProfile = System.getProperty("TestProfile", "ChwWork"); + currentProfile = hostName; LOGGER.info("Using test profile '" + this.currentProfile + "'"); } + private String getHostName() { + String hostname = "Unknown"; + + try + { + InetAddress addr = InetAddress.getLocalHost(); + hostname = addr.getHostName(); + } catch (UnknownHostException ex) { + LOGGER.warn("Hostname can not be resolved"); + } + + return hostname; + } + public void setCurrentProfile(final String currentProfile) { this.currentProfile = currentProfile; } diff --git a/src/main/java/util/test/PerformanceResult.java b/src/main/java/util/test/PerformanceResult.java index d6d77a6c0d0da014bd1d7c4637cbeaa9531e2aec..e852dce947b1b2531db723c986545668d1f61202 100644 --- a/src/main/java/util/test/PerformanceResult.java +++ b/src/main/java/util/test/PerformanceResult.java @@ -2,6 +2,8 @@ package util.test; import java.util.Map; +import util.test.eval.StatisticsUtil; + public class PerformanceResult { public long overallDurationInNs; diff --git a/src/main/java/util/BucketTimingsReader.java b/src/main/java/util/test/eval/BucketTimingsReader.java similarity index 97% rename from src/main/java/util/BucketTimingsReader.java rename to src/main/java/util/test/eval/BucketTimingsReader.java index 0efdfe65e9abf67179a5905c94c4894dfcab5843..9b17b9731bd17ae43edc0d7222955e79c8a6f5ae 100644 --- a/src/main/java/util/BucketTimingsReader.java +++ b/src/main/java/util/test/eval/BucketTimingsReader.java @@ -1,4 +1,4 @@ -package util; +package util.test.eval; import java.io.BufferedReader; import java.io.File; @@ -11,8 +11,6 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import util.test.StatisticsUtil; - import com.google.common.base.Charsets; import com.google.common.io.CharSource; import com.google.common.io.Files; diff --git a/src/main/java/util/test/StatisticsUtil.java b/src/main/java/util/test/eval/StatisticsUtil.java similarity index 98% rename from src/main/java/util/test/StatisticsUtil.java rename to src/main/java/util/test/eval/StatisticsUtil.java index 26a9bc35b3d1b6ade2c38fffe1296bb28579afb4..0f30e96be261a75d62f299fc807bc91cb4f06c99 100644 --- a/src/main/java/util/test/StatisticsUtil.java +++ b/src/main/java/util/test/eval/StatisticsUtil.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package util.test; +package util.test.eval; import java.util.ArrayList; import java.util.Collections; @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import teetime.util.MathUtil; import teetime.util.TimestampObject; +import util.test.PerformanceResult; /** * @author Christian Wulf diff --git a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java index 42c1732643de5af600c7433f60ae3ba3e8f14bb7..c60da1b243064ef59c651231d1ff067f0de745e7 100644 --- a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java @@ -13,7 +13,7 @@ public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerfor @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override @@ -27,12 +27,6 @@ public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerfor .get("testWithManyObjects(teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); PerformanceResult test15 = performanceResults .get("testWithManyObjects(teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); - PerformanceResult test16a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); - PerformanceResult test16b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); - PerformanceResult test16c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test19a = performanceResults .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19b = performanceResults @@ -69,24 +63,15 @@ public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerfor // assertEquals(78, value17, 4.1); // +3 // since 13.12.2014 (incl.) - assertEquals(40, value15, 4.1); // -28 + // assertEquals(40, value15, 4.1); // -28 // assertEquals(43, value17, 4.1); // -35 - // below results vary too much, possibly due to the OS' scheduler - // assertEquals(RESULT_TESTS_16, (double) test16a.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // assertEquals(RESULT_TESTS_16, (double) test16b.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // assertEquals(RESULT_TESTS_16, (double) test16c.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // - // assertEquals(RESULT_TESTS_19, (double) test19a.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // assertEquals(RESULT_TESTS_19, (double) test19b.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // assertEquals(RESULT_TESTS_19, (double) test19c.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); + // since 28.12.2014 (incl.) + assertEquals(30, value15, 4.1); // -10 // check speedup - assertEquals(2, (double) test16a.overallDurationInNs / test16b.overallDurationInNs, 0.3); - assertEquals(2.5, (double) test16a.overallDurationInNs / test16c.overallDurationInNs, 0.2); - assertEquals(2, (double) test19a.overallDurationInNs / test19b.overallDurationInNs, 0.3); - assertEquals(2.5, (double) test19a.overallDurationInNs / test19c.overallDurationInNs, 0.3); + assertEquals(2, (double) test19b.overallDurationInNs / test19c.overallDurationInNs, 0.3); } } diff --git a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java index bdfea3bef4b890ccd1da937b093dfa943afafafa..44b9227c3f2a3cd7c900a745709e56cf8b81e4dd 100644 --- a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java @@ -7,10 +7,8 @@ import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import teetime.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test; -import teetime.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test; +import teetime.examples.experiment09pipeimpls.MethodCallThoughputTimestampAnalysis9Test; import teetime.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test; -import teetime.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test; import teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test; import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; @@ -21,9 +19,7 @@ import util.test.PerformanceCheckProfileRepository; @SuiteClasses({ MethodCallThoughputTimestampAnalysis1Test.class, MethodCallThoughputTimestampAnalysis9Test.class, - MethodCallThoughputTimestampAnalysis10Test.class, MethodCallThoughputTimestampAnalysis11Test.class, - MethodCallThoughputTimestampAnalysis14Test.class, MethodCallThoughputTimestampAnalysis15Test.class, MethodCallThoughputTimestampAnalysis16Test.class, MethodCallThoughputTimestampAnalysis19Test.class, @@ -32,7 +28,7 @@ public class ComparisonMethodcallWithPorts { @BeforeClass public static void beforeClass() { - System.setProperty("logback.configurationFile", "src/test/resources/logback.groovy"); + // System.setProperty("logback.configurationFile", "src/test/resources/logback.groovy"); PerformanceCheckProfileRepository.INSTANCE.register(ComparisonMethodcallWithPorts.class, new ChwWorkComparisonMethodcallWithPorts()); PerformanceCheckProfileRepository.INSTANCE.register(ComparisonMethodcallWithPorts.class, new ChwHomeComparisonMethodcallWithPorts()); PerformanceCheckProfileRepository.INSTANCE.register(ComparisonMethodcallWithPorts.class, new NieWorkComparisonMethodcallWithPorts()); diff --git a/src/performancetest/java/teetime/examples/HostName.java b/src/performancetest/java/teetime/examples/HostName.java new file mode 100644 index 0000000000000000000000000000000000000000..b93ae4ec918cfb8adea87d02da24d0ef81444dcd --- /dev/null +++ b/src/performancetest/java/teetime/examples/HostName.java @@ -0,0 +1,23 @@ +package teetime.examples; + +public enum HostName { + + CHW_HOME("Nogge-PC"), + CHW_WORK("chw-PC"), + NIE_WORK("nie-PC"); + + private final String hostName; + + HostName(final String hostName) { + this.hostName = hostName; + } + + public String getHostName() { + return hostName; + } + + @Override + public String toString() { + return getHostName(); + } +} diff --git a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java index 4d336fd26cc106cf2013f4413d62a2e241b1f005..d5624898724371dc1df38ed11649c9e8cf5e0336 100644 --- a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java @@ -1,15 +1,16 @@ package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; +import util.test.AbstractProfiledPerformanceAssertion; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override diff --git a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java deleted file mode 100644 index 66bccb2bba83dfd3bdcde5b1b107e41691d323c9..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java +++ /dev/null @@ -1,22 +0,0 @@ -package teetime.examples.experiment09; - -import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import util.test.MeasurementRepository; -import util.test.PerformanceResult; -import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; - -abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { - - protected PerformanceResult test01; - protected PerformanceResult test09; - - @Override - public void check() { - String testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis1Test.class, "testWithManyObjects"); - test01 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis9Test.class, "testWithManyObjects"); - test09 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - } - -} diff --git a/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java deleted file mode 100644 index a1f37f2cb557f85656e5ca3a377b1a092c744b72..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java +++ /dev/null @@ -1,35 +0,0 @@ -package teetime.examples.experiment09; - -import static org.junit.Assert.assertEquals; - -class ChwHomePerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwHome"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test09.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("medianSpeedup (09): " + medianSpeedup); - - // until 25.06.2014 (incl.) - // assertEquals(22, (double) test9.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); - // since 26.06.2014 (incl.) - // assertEquals(36, value9, 2.1); // +14 - // since 04.07.2014 (incl.) - // assertEquals(42, value9, 2.1); // +6 - // since 11.08.2014 (incl.) - // assertEquals(42, value9, 2.1); // +6 - // since 31.08.2014 (incl.) - // assertEquals(44, medianSpeedup, 2.1); // +2 - // since 04.11.2014 (incl.) - // assertEquals(71, medianSpeedup, 2.1); // +33 - // since 05.12.2014 (incl.) - assertEquals(45, medianSpeedup, 2.1); // -26 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment09/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/ChwWorkPerformanceCheck.java deleted file mode 100644 index 5359eddcfda3a73fafe83f18b61089b770152033..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment09/ChwWorkPerformanceCheck.java +++ /dev/null @@ -1,33 +0,0 @@ -package teetime.examples.experiment09; - -import static org.junit.Assert.assertEquals; - -class ChwWorkPerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwWork"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test09.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("medianSpeedup (09): " + medianSpeedup); - - // until 25.06.2014 (incl.) - // assertEquals(22, (double) test9.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); - // since 26.06.2014 (incl.) - // assertEquals(36, value9, 2.1); // +14 - // since 04.07.2014 (incl.) - // assertEquals(42, value9, 2.1); // +6 - // since 27.08.2014 (incl.) - // assertEquals(77, value9, 2.1); // +35 - // since 14.10.2014 (incl.) - // assertEquals(67, medianSpeedup, 3.1); // -10 - // since 19.12.2014 (incl.) - assertEquals(53, medianSpeedup, 3.1); // -14 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/AbstractPerformanceCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..f821b423ef9c2fdfc0faf722494d6393718621ab --- /dev/null +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/AbstractPerformanceCheck.java @@ -0,0 +1,31 @@ +package teetime.examples.experiment09pipeimpls; + +import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; +import util.test.AbstractProfiledPerformanceAssertion; +import util.test.MeasurementRepository; +import util.test.PerformanceResult; +import util.test.PerformanceTest; + +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { + + protected PerformanceResult test01; + protected PerformanceResult test09CommittablePipes; + protected PerformanceResult test09SingleElementPipes; + protected PerformanceResult test09OrderedGrowableArrayPipes; + + @Override + public void check() { + String testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis1Test.class, "testWithManyObjects"); + test01 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); + + testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis9Test.class, "testCommittablePipes"); + test09CommittablePipes = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); + + testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis9Test.class, "testSingleElementPipes"); + test09SingleElementPipes = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); + + testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis9Test.class, "testOrderedGrowableArrayPipes"); + test09OrderedGrowableArrayPipes = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); + } + +} diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..683d2002156e67aae7902ba695a27f333c4e49ec --- /dev/null +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwHomePerformanceCheck.java @@ -0,0 +1,87 @@ +package teetime.examples.experiment09pipeimpls; + +import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; + +class ChwHomePerformanceCheck extends AbstractPerformanceCheck { + + @Override + public String getCorrespondingPerformanceProfile() { + return HostName.CHW_HOME.toString(); + } + + @Override + public void check() { + super.check(); + + checkCommittablePipes(); + checkSingleElementPipes(); + checkOrderedGrowableArrayPipes(); + } + + private void checkCommittablePipes() { + double medianSpeedup = (double) test09CommittablePipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("medianSpeedup (09 committable pipes): " + medianSpeedup); + + // until 25.06.2014 (incl.) + // assertEquals(22, (double) test9.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); + // since 26.06.2014 (incl.) + // assertEquals(36, value9, 2.1); // +14 + // since 04.07.2014 (incl.) + // assertEquals(42, value9, 2.1); // +6 + // since 11.08.2014 (incl.) + // assertEquals(42, value9, 2.1); // +6 + // since 31.08.2014 (incl.) + // assertEquals(44, medianSpeedup, 2.1); // +2 + // since 04.11.2014 (incl.) + // assertEquals(71, medianSpeedup, 2.1); // +27 + // since 05.12.2014 (incl.) + assertEquals(43, medianSpeedup, 4.1); // -28 (41-56) + } + + private void checkSingleElementPipes() { + double medianSpeedup = (double) test09SingleElementPipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("meanSpeedup (09 single element pipes): " + medianSpeedup); + + // since 26.06.2014 (incl.) + // assertEquals(26, value10, 2.1); // +14 + // // since 04.07.2014 (incl.) + // assertEquals(26, value10, 2.1); // +0 + // since 11.08.2014 (incl.) + // assertEquals(47, value10, 2.1); // +21 + // since 31.08.2014 (incl.) + // assertEquals(51, medianSpeedup, 3.2); // +4 + // since 13.12.2014 (incl.) + // assertEquals(40, medianSpeedup, 3.2); // -11 + // since 28.12.2014 (incl.) + assertEquals(26, medianSpeedup, 3.2); // -14 + } + + private void checkOrderedGrowableArrayPipes() { + double medianSpeedup = (double) test09OrderedGrowableArrayPipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("medianSpeedup (09 ordered growable array pipes): " + medianSpeedup); + + // until 25.06.2014 (incl.) + // assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); + // since 26.06.2014 (incl.) + // assertEquals(76, medianSpeedup, 5.1); // +16 + // since 04.07.2014 (incl.) + // assertEquals(86, medianSpeedup, 5.1); // +16 + // since 11.08.2014 (incl.) + // assertEquals(103, medianSpeedup, 5.1); // +17 + // since 31.08.2014 (incl.) + // assertEquals(62, medianSpeedup, 2.1); // -41 + // since 04.11.2014 (incl.) + // assertEquals(84, medianSpeedup, 2.1); // +22 + // since 05.12.2014 (incl.) + // assertEquals(75, medianSpeedup, 2.1); // -9 + // since 13.12.2014 (incl.) + // assertEquals(44, medianSpeedup, 2.1); // -31 + // since 28.12.2014 (incl.) + assertEquals(46, medianSpeedup, 2.1); // +2 + } + +} diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwWorkPerformanceCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..a84f8fab6b438d71f81f72937ae00872215607f2 --- /dev/null +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/ChwWorkPerformanceCheck.java @@ -0,0 +1,76 @@ +package teetime.examples.experiment09pipeimpls; + +import static org.junit.Assert.assertEquals; + +class ChwWorkPerformanceCheck extends AbstractPerformanceCheck { + + @Override + public String getCorrespondingPerformanceProfile() { + return "ChwWork"; + } + + @Override + public void check() { + super.check(); + + checkCommittablePipes(); + checkSingleElementPipes(); + checkOrderedGrowableArrayPipes(); + } + + private void checkCommittablePipes() { + double medianSpeedup = (double) test09CommittablePipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("medianSpeedup (09): " + medianSpeedup); + + // until 25.06.2014 (incl.) + // assertEquals(22, (double) test9.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); + // since 26.06.2014 (incl.) + // assertEquals(36, value9, 2.1); // +14 + // since 04.07.2014 (incl.) + // assertEquals(42, value9, 2.1); // +6 + // since 27.08.2014 (incl.) + // assertEquals(77, value9, 2.1); // +35 + // since 14.10.2014 (incl.) + // assertEquals(67, medianSpeedup, 3.1); // -10 + // since 19.12.2014 (incl.) + assertEquals(53, medianSpeedup, 3.1); // -14 + } + + private void checkSingleElementPipes() { + double medianSpeedup = (double) test09SingleElementPipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("medianSpeedup (09 single element pipes): " + medianSpeedup); + + // until 25.06.2014 (incl.) + // assertEquals(14, (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); + // since 26.06.2014 (incl.) + // assertEquals(26, meanSpeedup, 2.1); // +14 + // since 04.07.2014 (incl.) + // assertEquals(26, meanSpeedup, 2.1); // +0 + // since 27.08.2014 (incl.) + // assertEquals(56, meanSpeedup, 2.1); // +30 + // since 14.10.2014 (incl.) + assertEquals(25, medianSpeedup, 3.1); // -31 + } + + private void checkOrderedGrowableArrayPipes() { + double medianSpeedup = (double) test09OrderedGrowableArrayPipes.quantiles.get(0.5) / test01.quantiles.get(0.5); + + System.out.println("medianSpeedup (09 ordered growable array pipes): " + medianSpeedup); + + // until 25.06.2014 (incl.) + // assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); + // since 26.06.2014 (incl.) + // assertEquals(76, medianSpeedup, 5.1); // +16 + // since 04.07.2014 (incl.) + // assertEquals(86, medianSpeedup, 5.1); // +16 + // since 27.08.2014 (incl.) + // assertEquals(102, medianSpeedup, 5.1); // +16 + // since 14.10.2014 (incl.) + // assertEquals(81, medianSpeedup, 5.1); // -21 + // since 19.12.2014 (incl.) + assertEquals(56, medianSpeedup, 5.1); // -25 + } + +} diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java similarity index 66% rename from src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java rename to src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java index a8072963ef838c9c08887290daca5c9754a42200..eba54e13f3b6d62eead71a126504e5232e5556d9 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThoughputTimestampAnalysis9Test.java @@ -13,16 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.examples.experiment09; +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.PerformanceTest; import util.test.AbstractProfiledPerformanceAssertion; +import util.test.PerformanceTest; /** * @author Christian Wulf @@ -35,16 +41,40 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { public static void beforeClass() { PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwWorkPerformanceCheck()); PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwHomePerformanceCheck()); - }; + } @AfterClass public static void afterClass() { AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); performanceCheckProfile.check(); - }; + } @Test - public void testWithManyObjects() { + public void testCommittablePipes() throws Exception { + IPipeFactory pipeFactory = new CommittablePipeFactory(); + testWithManyObjects(pipeFactory); + } + + @Test + public void testSingleElementPipes() throws Exception { + IPipeFactory pipeFactory = new SingleElementPipeFactory(); + testWithManyObjects(pipeFactory); + } + + @Test + public void testOrderedGrowableArrayPipes() throws Exception { + IPipeFactory pipeFactory = new OrderedGrowableArrayPipeFactory(); + 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 + "..."); @@ -57,7 +87,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { return new TimestampObject(); } }); - analysis.init(); + analysis.init(pipeFactory); this.stopWatch.start(); try { diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java similarity index 81% rename from src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java rename to src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java index 9f96c90e0a321afbe7e69a2b69e81f27d3f50e1b..718b3295c00e56e6c2caa89dff663e2c0425a62e 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.examples.experiment09; +package teetime.examples.experiment09pipeimpls; import java.util.List; -import teetime.framework.Stage; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableProducerStage; -import teetime.framework.pipe.CommittablePipe; +import teetime.framework.Stage; +import teetime.framework.pipe.IPipeFactory; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; import teetime.stage.ObjectProducer; @@ -42,17 +42,18 @@ public class MethodCallThroughputAnalysis9 { private List<TimestampObject> timestampObjects; private Runnable runnable; - public void init() { - Stage pipeline = this.buildPipeline(); + public void init(final IPipeFactory pipeFactory) { + Stage pipeline = this.buildPipeline(pipeFactory); this.runnable = new RunnableProducerStage(pipeline); } /** + * @param pipeFactory * @param numNoopFilters * @return * @since 1.10 */ - private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline() { + private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final IPipeFactory pipeFactory) { @SuppressWarnings("unchecked") final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; // create stages @@ -68,13 +69,13 @@ public class MethodCallThroughputAnalysis9 { pipeline.setFirstStage(objectProducer); pipeline.setLastStage(collectorSink); - CommittablePipe.connect(objectProducer.getOutputPort(), startTimestampFilter.getInputPort()); - CommittablePipe.connect(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort()); + pipeFactory.create(objectProducer.getOutputPort(), startTimestampFilter.getInputPort()); + pipeFactory.create(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort()); for (int i = 0; i < noopFilters.length - 1; i++) { - CommittablePipe.connect(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort()); + pipeFactory.create(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort()); } - CommittablePipe.connect(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort()); - CommittablePipe.connect(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort()); + pipeFactory.create(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort()); + pipeFactory.create(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort()); return pipeline; } diff --git a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java deleted file mode 100644 index 972d560839c9419d54fd2e9fc84ba01b16c3cc8b..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java +++ /dev/null @@ -1,22 +0,0 @@ -package teetime.examples.experiment10; - -import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import util.test.MeasurementRepository; -import util.test.PerformanceResult; -import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; - -abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { - - protected PerformanceResult test01; - protected PerformanceResult test10; - - @Override - public void check() { - String testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis1Test.class, "testWithManyObjects"); - test01 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis10Test.class, "testWithManyObjects"); - test10 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - } - -} diff --git a/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java deleted file mode 100644 index a2bb94e35b648032e06d3534edde8a311ccfc9eb..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java +++ /dev/null @@ -1,31 +0,0 @@ -package teetime.examples.experiment10; - -import static org.junit.Assert.assertEquals; - -class ChwHomePerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwHome"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test10.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("meanSpeedup (10): " + medianSpeedup); - - // since 26.06.2014 (incl.) - // assertEquals(26, value10, 2.1); // +14 - // // since 04.07.2014 (incl.) - // assertEquals(26, value10, 2.1); // +0 - // since 11.08.2014 (incl.) - // assertEquals(47, value10, 2.1); // +21 - // since 31.08.2014 (incl.) - // assertEquals(51, medianSpeedup, 3.2); // +4 - // since 13.12.2014 (incl.) - assertEquals(40, medianSpeedup, 3.2); // -11 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment10/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/ChwWorkPerformanceCheck.java deleted file mode 100644 index bbb49ded324bbea6fa44fa9561c4a7676b1241ea..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment10/ChwWorkPerformanceCheck.java +++ /dev/null @@ -1,31 +0,0 @@ -package teetime.examples.experiment10; - -import static org.junit.Assert.assertEquals; - -class ChwWorkPerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwWork"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test10.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("medianSpeedup (10): " + medianSpeedup); - - // until 25.06.2014 (incl.) - // assertEquals(14, (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); - // since 26.06.2014 (incl.) - // assertEquals(26, meanSpeedup, 2.1); // +14 - // since 04.07.2014 (incl.) - // assertEquals(26, meanSpeedup, 2.1); // +0 - // since 27.08.2014 (incl.) - // assertEquals(56, meanSpeedup, 2.1); // +30 - // since 14.10.2014 (incl.) - assertEquals(25, medianSpeedup, 3.1); // -31 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java deleted file mode 100644 index aac62e41839dfe71af9edddd098084aeefbd996f..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ -package teetime.examples.experiment10; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.util.TimestampObject; -import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest { - - @BeforeClass - public static void beforeClass() { - PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis10Test.class, new ChwWorkPerformanceCheck()); - PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis10Test.class, new ChwHomePerformanceCheck()); - }; - - @AfterClass - public static void afterClass() { - AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); - performanceCheckProfile.check(); - }; - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis10 analysis = new MethodCallThroughputAnalysis10(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java deleted file mode 100644 index 70b476ffc2cea8ae1e15a3b66456ffd40dee650c..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ -package teetime.examples.experiment10; - -import java.util.List; - -import teetime.framework.OldHeadPipeline; -import teetime.framework.RunnableProducerStage; -import teetime.framework.pipe.SingleElementPipe; -import teetime.stage.CollectorSink; -import teetime.stage.NoopFilter; -import teetime.stage.ObjectProducer; -import teetime.stage.StartTimestampFilter; -import teetime.stage.StopTimestampFilter; -import teetime.util.ConstructorClosure; -import teetime.util.TimestampObject; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis10 { - - private long numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - public void init() { - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> pipeline = new OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>>(); - pipeline.setFirstStage(objectProducer); - pipeline.setLastStage(collectorSink); - - SingleElementPipe.connect(objectProducer.getOutputPort(), startTimestampFilter.getInputPort()); - SingleElementPipe.connect(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort()); - for (int i = 0; i < noopFilters.length - 1; i++) { - SingleElementPipe.connect(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort()); - } - SingleElementPipe.connect(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort()); - SingleElementPipe.connect(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort()); - - return new RunnableProducerStage(pipeline); - } - - public void start() { - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java index 0aa9e619b6275fda1dbdd1264eed12df558741fc..3cac21615bf1fbfc5de9e103a6aa9a6ab9958c2d 100644 --- a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java @@ -1,15 +1,16 @@ package teetime.examples.experiment11; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; +import util.test.AbstractProfiledPerformanceAssertion; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override diff --git a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java deleted file mode 100644 index b3dfc404714d86910880d8556c2e1596dc670b90..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java +++ /dev/null @@ -1,22 +0,0 @@ -package teetime.examples.experiment14; - -import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import util.test.MeasurementRepository; -import util.test.PerformanceResult; -import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; - -abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { - - protected PerformanceResult test01; - protected PerformanceResult test14; - - @Override - public void check() { - String testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis1Test.class, "testWithManyObjects"); - test01 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis14Test.class, "testWithManyObjects"); - test14 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier); - } - -} diff --git a/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java deleted file mode 100644 index bab145f6ebce1b8742a2530aad145b0b12a542b7..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java +++ /dev/null @@ -1,37 +0,0 @@ -package teetime.examples.experiment14; - -import static org.junit.Assert.assertEquals; - -class ChwHomePerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwHome"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test14.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("medianSpeedup (14): " + medianSpeedup); - - // until 25.06.2014 (incl.) - // assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // since 26.06.2014 (incl.) - // assertEquals(76, medianSpeedup, 5.1); // +16 - // since 04.07.2014 (incl.) - // assertEquals(86, medianSpeedup, 5.1); // +16 - // since 11.08.2014 (incl.) - // assertEquals(103, medianSpeedup, 5.1); // +17 - // since 31.08.2014 (incl.) - // assertEquals(62, medianSpeedup, 2.1); // -41 - // since 04.11.2014 (incl.) - // assertEquals(84, medianSpeedup, 2.1); // +22 - // since 05.12.2014 (incl.) - // assertEquals(75, medianSpeedup, 2.1); // -9 - // since 13.12.2014 (incl.) - assertEquals(44, medianSpeedup, 2.1); // -31 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment14/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/ChwWorkPerformanceCheck.java deleted file mode 100644 index b2d4deed66518910d7475f1dea702e425c491dbd..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment14/ChwWorkPerformanceCheck.java +++ /dev/null @@ -1,33 +0,0 @@ -package teetime.examples.experiment14; - -import static org.junit.Assert.assertEquals; - -class ChwWorkPerformanceCheck extends AbstractPerformanceCheck { - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwWork"; - } - - @Override - public void check() { - super.check(); - - double medianSpeedup = (double) test14.quantiles.get(0.5) / test01.quantiles.get(0.5); - - System.out.println("medianSpeedup (14): " + medianSpeedup); - - // until 25.06.2014 (incl.) - // assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); - // since 26.06.2014 (incl.) - // assertEquals(76, medianSpeedup, 5.1); // +16 - // since 04.07.2014 (incl.) - // assertEquals(86, medianSpeedup, 5.1); // +16 - // since 27.08.2014 (incl.) - // assertEquals(102, medianSpeedup, 5.1); // +16 - // since 14.10.2014 (incl.) - // assertEquals(81, medianSpeedup, 5.1); // -21 - // since 19.12.2014 (incl.) - assertEquals(56, medianSpeedup, 5.1); // -25 - } -} diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java deleted file mode 100644 index 75e7df4e331481e06dee39bddc311e2532488fb8..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java +++ /dev/null @@ -1,70 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ -package teetime.examples.experiment14; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.util.TimestampObject; -import util.test.PerformanceTest; -import util.test.AbstractProfiledPerformanceAssertion; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis14Test extends PerformanceTest { - - @BeforeClass - public static void beforeClass() { - PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis14Test.class, new ChwWorkPerformanceCheck()); - PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis14Test.class, new ChwHomePerformanceCheck()); - }; - - @AfterClass - public static void afterClass() { - AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class); - performanceCheckProfile.check(); - }; - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis14 analysis = new MethodCallThroughputAnalysis14(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java deleted file mode 100644 index 2f871761f6fbe15881927fdf22359e3ef25fc0a6..0000000000000000000000000000000000000000 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ -package teetime.examples.experiment14; - -import java.util.List; - -import teetime.framework.Stage; -import teetime.framework.OldHeadPipeline; -import teetime.framework.RunnableProducerStage; -import teetime.framework.pipe.IPipeFactory; -import teetime.framework.pipe.PipeFactoryRegistry; -import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; -import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; -import teetime.stage.CollectorSink; -import teetime.stage.NoopFilter; -import teetime.stage.ObjectProducer; -import teetime.stage.StartTimestampFilter; -import teetime.stage.StopTimestampFilter; -import teetime.util.ConstructorClosure; -import teetime.util.TimestampObject; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis14 { - - private long numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - private final PipeFactoryRegistry pipeFactory = PipeFactoryRegistry.INSTANCE; - - public void init() { - Stage pipeline = this.buildPipeline(); - this.runnable = new RunnableProducerStage(pipeline); - } - - /** - * @param numNoopFilters - * @return - * @since 1.10 - */ - private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> pipeline = new OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>>(); - pipeline.setFirstStage(objectProducer); - pipeline.setLastStage(collectorSink); - - IPipeFactory factory = this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.QUEUE_BASED, true); - - factory.create(objectProducer.getOutputPort(), startTimestampFilter.getInputPort()); - factory.create(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort()); - for (int i = 0; i < noopFilters.length - 1; i++) { - factory.create(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort()); - } - factory.create(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort()); - factory.create(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort()); - - return pipeline; - } - - public void start() { - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java index 11a831ba5613fa4df690dd01b812f1b2e7517f72..57504af5a97d65b20b7f43e1b137cae395793dcf 100644 --- a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java @@ -1,6 +1,7 @@ package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; import util.test.AbstractProfiledPerformanceAssertion; import util.test.PerformanceResult; import util.test.PerformanceTest; @@ -9,7 +10,7 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override @@ -21,11 +22,11 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults .get("testWithManyObjectsAnd4Threads(" + MethodCallThoughputTimestampAnalysis16Test.class.getName() + ")"); // check speedup - double speedupB = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; - double speedupC = (double) test16a.overallDurationInNs / test16c.overallDurationInNs; + double speedupA2B = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; + double speedupB2C = (double) test16b.overallDurationInNs / test16c.overallDurationInNs; - System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupB: " + speedupB); - System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupC: " + speedupC); + System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupB: " + speedupA2B); + System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupC: " + speedupB2C); // assertEquals(2, speedupB, 0.3); // since 31.08.2014 (incl.) @@ -33,7 +34,10 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { // since 04.11.2014 (incl.) // assertEquals(5, speedupC, 0.4); // since 07.12.2014 (incl.) - assertEquals(2, speedupB, 0.4); - assertEquals(5, speedupC, 0.4); + // assertEquals(2, speedupA2B, 0.4); + // assertEquals(5, speedupB2C, 0.4); + // since 28.12.2014 (incl.) + assertEquals(2, speedupA2B, 0.4); + assertEquals(2, speedupB2C, 0.4); } } diff --git a/src/performancetest/java/teetime/framework/OldPipeline.java b/src/performancetest/java/teetime/framework/OldPipeline.java index 3ee0a72a15b0adf7dae5839e77602e16c6792189..225cf0dddb9c32327ef06d8d56a8aefb7532aa76 100644 --- a/src/performancetest/java/teetime/framework/OldPipeline.java +++ b/src/performancetest/java/teetime/framework/OldPipeline.java @@ -58,13 +58,13 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> exte } @Override - public void setOwningThread(final Thread owningThread) { - firstStage.setOwningThread(owningThread); + public Thread getOwningThread() { + return firstStage.getOwningThread(); } @Override - public Thread getOwningThread() { - return firstStage.getOwningThread(); + void setOwningThread(final Thread owningThread) { + firstStage.setOwningThread(owningThread); } @Override diff --git a/src/performancetest/java/teetime/util/StopWatchTest.java b/src/performancetest/java/teetime/util/StopWatchTest.java index 5c0a6a0d721e27e2c44694115ce2b40576e27ec3..e7ad6ec973e556e6ec229c9c7ee6807af5b49ee5 100644 --- a/src/performancetest/java/teetime/util/StopWatchTest.java +++ b/src/performancetest/java/teetime/util/StopWatchTest.java @@ -7,7 +7,7 @@ import java.util.Map; import org.junit.Test; -import util.test.StatisticsUtil; +import util.test.eval.StatisticsUtil; public class StopWatchTest { diff --git a/src/site/markdown/wiki b/src/site/markdown/wiki index 0e4474577e1f49bc96e734c286b2d9e0363895e8..cdfd44ee829e7bba079ee71983e5711a4e6cb259 160000 --- a/src/site/markdown/wiki +++ b/src/site/markdown/wiki @@ -1 +1 @@ -Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8 +Subproject commit cdfd44ee829e7bba079ee71983e5711a4e6cb259 diff --git a/src/test/java/util/test/PerformanceTest.java b/src/test/java/util/test/PerformanceTest.java index 031b4f62052ce12de8d16c146c461c4926abdbcc..7a4b0895cbababddf7e3556738e0e4d2f6e6ab1c 100644 --- a/src/test/java/util/test/PerformanceTest.java +++ b/src/test/java/util/test/PerformanceTest.java @@ -13,6 +13,7 @@ import org.junit.runner.Description; import teetime.util.StopWatch; import teetime.util.TimestampObject; +import util.test.eval.StatisticsUtil; public abstract class PerformanceTest { diff --git a/src/test/resources/logback-test.xml b/src/test/resources/logback-test.xml index 5f80ba17fdeb66f9b262a429f33e45cad15b1e69..8a46d9dceb368d68288f19ace8edb4b8a6c2631b 100644 --- a/src/test/resources/logback-test.xml +++ b/src/test/resources/logback-test.xml @@ -20,8 +20,8 @@ </encoder> </appender> - <logger name="teetime.framework" level="TRACE" /> - <logger name="teetime.stage" level="TRACE" /> +<!-- <logger name="teetime.framework" level="TRACE" /> --> +<!-- <logger name="teetime.stage" level="TRACE" /> --> <logger name="teetime" level="INFO" /> <logger name="util" level="INFO" />