diff --git a/.classpath b/.classpath index 21206d20b9ff32b5de873afae65814d769e3f716..eab1b08c8ced2c847dfab44d6ddfa2cda9461fd8 100644 --- a/.classpath +++ b/.classpath @@ -13,6 +13,8 @@ </attributes> </classpathentry> <classpathentry kind="src" path="conf"/> + <classpathentry kind="src" path="src/test/resources"/> + <classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="maven.pomderived" value="true"/> diff --git a/conf/logging.properties b/conf/logging.properties deleted file mode 100644 index 0c3fdb94be28e2c8d6214114b74e0a90df8abc6f..0000000000000000000000000000000000000000 --- a/conf/logging.properties +++ /dev/null @@ -1,14 +0,0 @@ -.handlers = java.util.logging.ConsoleHandler -.level = WARNING - -java.util.logging.ConsoleHandler.level = ALL -#java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -java.util.logging.SimpleFormatter.format=[%1$tF %1$tr] %4$s: %5$s (%2$s) %6$s %n - -#teetime.level = ALL - -#teetime.variant.methodcallWithPorts.framework.level = ALL -#teetime.variant.methodcallWithPorts.framework.core.level = FINE -teetime.variant.methodcallWithPorts.stage.level = INFO -#teetime.variant.methodcallWithPorts.examples.traceReconstructionWithThreads.level = FINE -teetime.variant.methodcallWithPorts.examples.kiekerdays.level = FINE diff --git a/src/main/java/util/PerformanceTest.java b/src/main/java/util/PerformanceTest.java index b85aacc4e57c268ff29b142313a48bab42e4aa57..0887ae91af09f5bcf3ecdb3cbcb007b7f0973b60 100644 --- a/src/main/java/util/PerformanceTest.java +++ b/src/main/java/util/PerformanceTest.java @@ -6,6 +6,7 @@ import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; @@ -14,8 +15,6 @@ import org.junit.runner.Description; import teetime.util.StopWatch; import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import kieker.common.logging.LogFactory; - public abstract class PerformanceTest { protected static final int NUM_OBJECTS_TO_CREATE = 100000; @@ -28,6 +27,11 @@ public abstract class PerformanceTest { protected StopWatch stopWatch; protected List<TimestampObject> timestampObjects; + @BeforeClass + public static void beforeClass() { + System.setProperty("logback.configurationFile", "src/test/resources/logback-test.groovy"); + } + @Rule public final TestRule watcher = new TestWatcher() { @Override @@ -39,7 +43,6 @@ public abstract class PerformanceTest { @Before public void before() { - System.setProperty(LogFactory.CUSTOM_LOGGER_JVM, "NONE"); this.stopWatch = new StopWatch(); this.timestampObjects = new ArrayList<TimestampObject>(NUM_OBJECTS_TO_CREATE); } @@ -56,4 +59,5 @@ public abstract class PerformanceTest { System.out.println("[" + TimeUnit.NANOSECONDS.toMicros(performanceResult.avgDurInNs - performanceResult.confidenceWidthInNs) + " µs, " + TimeUnit.NANOSECONDS.toMicros(performanceResult.avgDurInNs + performanceResult.confidenceWidthInNs) + " µs]"); } + } diff --git a/conf/logback.groovy b/src/main/resources/logback.groovy similarity index 100% rename from conf/logback.groovy rename to src/main/resources/logback.groovy diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java b/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..aeab2733bbfc9771a3b63eb74fc953e0982e3588 --- /dev/null +++ b/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java @@ -0,0 +1,22 @@ +package teetime.variant.methodcall.examples.experiment01; + +import static org.junit.Assert.assertEquals; +import util.PerformanceCheckProfile; +import util.PerformanceResult; +import util.PerformanceTest; + +public class ChwHomePerformanceCheck implements PerformanceCheckProfile { + + @Override + public String getCorrespondingPerformanceProfile() { + return "ChwHome"; + } + + @Override + public void check() { + PerformanceResult test01 = PerformanceTest.measurementRepository.performanceResults + .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + + assertEquals(292, test01.quantiles.get(0.5), 1); + } +} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwWorkPerformanceCheck.java b/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwWorkPerformanceCheck.java new file mode 100644 index 0000000000000000000000000000000000000000..44fa5ff7c9ede67e29c7e4e391536df1ebe178e1 --- /dev/null +++ b/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwWorkPerformanceCheck.java @@ -0,0 +1,22 @@ +package teetime.variant.methodcall.examples.experiment01; + +import static org.junit.Assert.assertEquals; +import util.PerformanceCheckProfile; +import util.PerformanceResult; +import util.PerformanceTest; + +public class ChwWorkPerformanceCheck implements PerformanceCheckProfile { + + @Override + public String getCorrespondingPerformanceProfile() { + return "ChwWork"; + } + + @Override + public void check() { + PerformanceResult test01 = PerformanceTest.measurementRepository.performanceResults + .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + + assertEquals(410, test01.quantiles.get(0.5), 1); + } +} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java index 45a41b5c50fe6d764ff6c992e72cf410a7eb14d1..e40923d0255bf8ae9c8d4ae260b8f85652ee0259 100644 --- a/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java +++ b/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java @@ -15,23 +15,35 @@ ***************************************************************************/ package teetime.variant.methodcall.examples.experiment01; -import static org.junit.Assert.assertEquals; - +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceResult; +import util.PerformanceCheckProfile; +import util.PerformanceCheckProfileRepository; import util.PerformanceTest; -import util.StatisticsUtil; /** * @author Christian Wulf - * + * * @since 1.10 */ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest { + @BeforeClass + public static void beforeClass() { + PerformanceCheckProfileRepository.INSTANCE.register(MethodCallThoughputTimestampAnalysis1Test.class, new ChwWorkPerformanceCheck()); + PerformanceCheckProfileRepository.INSTANCE.register(MethodCallThoughputTimestampAnalysis1Test.class, new ChwHomePerformanceCheck()); + }; + + @AfterClass + public static void afterClass() { + PerformanceCheckProfile performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); + performanceCheckProfile.check(); + }; + // TODO check why the optimal, but inflexible impl is 500 times faster than our new framework @Test @@ -56,9 +68,6 @@ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest { } finally { this.stopWatch.end(); } - - PerformanceResult performanceResult = StatisticsUtil.computeStatistics(this.stopWatch.getDurationInNs(), this.timestampObjects); - assertEquals(292, performanceResult.quantiles.get(0.5), 1); // chw home } } diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java index a924a70d6d2a243fe6ac0bdd8709370d0adb6ae3..bf966214143a271153ba88d47a6a890b9f292454 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java +++ b/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java @@ -7,6 +7,11 @@ import util.PerformanceTest; public class ChwHomePerformanceCheck implements PerformanceCheckProfile { + @Override + public String getCorrespondingPerformanceProfile() { + return "ChwHome"; + } + @Override public void check() { PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults @@ -25,9 +30,4 @@ public class ChwHomePerformanceCheck implements PerformanceCheckProfile { assertEquals(2, speedupB, 0.3); assertEquals(3, speedupC, 0.3); } - - @Override - public String getCorrespondingPerformanceProfile() { - return "ChwHome"; - } } diff --git a/src/test/resources/logback-test.groovy b/src/test/resources/logback-test.groovy new file mode 100644 index 0000000000000000000000000000000000000000..a9a3608d488c4d5a0d982f7ac8c35c8f24bd6285 --- /dev/null +++ b/src/test/resources/logback-test.groovy @@ -0,0 +1,22 @@ +import ch.qos.logback.classic.filter.ThresholdFilter + +statusListener(OnConsoleStatusListener) + +appender("FILE", FileAppender) { + file = "src/test/data/load-logs/timings-results.txt" + append = false + filter(ThresholdFilter) { + level = INFO + } + encoder(PatternLayoutEncoder) { + pattern = "%msg%n" + } +} + +appender("CONSOLE", ConsoleAppender) { + encoder(PatternLayoutEncoder) { + pattern = "%d{HH:mm:ss.SSS} %level %logger - %msg%n" + } +} + +root ERROR, ["CONSOLE"]