From ead2a19c6770783e28ce00c327a8a0eeafde32c2 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Fri, 4 Jul 2014 12:54:03 +0200 Subject: [PATCH] added sysout for speedup tests --- ...dCallThoughputTimestampAnalysis16Test.java | 34 ++++++++++++------- .../MethodCallThroughputAnalysis16.java | 9 ----- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java index 2da06889..13dd2e8e 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java +++ b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java @@ -15,6 +15,9 @@ ***************************************************************************/ package teetime.variant.methodcallWithPorts.examples.experiment16; +import static org.junit.Assert.assertEquals; + +import org.junit.AfterClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @@ -22,6 +25,7 @@ import org.junit.runners.MethodSorters; import teetime.util.ConstructorClosure; import teetime.util.ListUtil; import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import test.PerformanceResult; import test.PerformanceTest; /** @@ -49,18 +53,24 @@ public class MethodCallThoughputTimestampAnalysis16Test extends PerformanceTest this.performAnalysis(4); } - // @AfterClass - // public static void afterClass() { - // PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); - // PerformanceResult test16b = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); - // PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); - // // check speedup - // assertEquals(2, (double) test16a.overallDurationInNs / test16b.overallDurationInNs, 0.2); - // assertEquals(2.5, (double) test16a.overallDurationInNs / test16c.overallDurationInNs, 0.2); - // } + @AfterClass + public static void afterClass() { + PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults + .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + PerformanceResult test16b = PerformanceTest.measurementRepository.performanceResults + .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults + .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + // check speedup + double speedupB = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; + double speedupC = (double) test16a.overallDurationInNs / test16c.overallDurationInNs; + + System.out.println("speedupB: " + speedupB); + System.out.println("speedupC: " + speedupC); + + assertEquals(2, speedupB, 0.3); + assertEquals(2.5, speedupC, 0.3); + } private void performAnalysis(final int numThreads) { System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java index da66f567..b9dc83f3 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java +++ b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java @@ -74,15 +74,6 @@ public class MethodCallThroughputAnalysis16 extends Analysis { Pipeline<TimestampObject, Void> workerPipeline = this.buildPipeline(producerPipeline, resultList); this.workerThreads[i] = new Thread(new RunnableStage<TimestampObject>(workerPipeline)); } - - // this.producerThread.start(); - // - // try { - // this.producerThread.join(); - // } catch (InterruptedException e1) { - // // TODO Auto-generated catch block - // e1.printStackTrace(); - // } } private Pipeline<Void, TimestampObject> buildProducerPipeline(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { -- GitLab