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/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java index 42c1732643de5af600c7433f60ae3ba3e8f14bb7..77d7dbaa3727a06e8a97b4cac189af19fa3b216f 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 @@ -72,19 +66,7 @@ public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerfor 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); - // 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); } diff --git a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java index bdfea3bef4b890ccd1da937b093dfa943afafafa..6269483291a6e0dd2790d18e75e5c14d73023016 100644 --- a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java @@ -32,7 +32,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/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java index a1f37f2cb557f85656e5ca3a377b1a092c744b72..5c9413409bdaf5d3c05c29981b65c9a10a8b05be 100644 --- a/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment09/ChwHomePerformanceCheck.java @@ -1,12 +1,13 @@ package teetime.examples.experiment09; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; class ChwHomePerformanceCheck extends AbstractPerformanceCheck { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override @@ -30,6 +31,8 @@ class ChwHomePerformanceCheck extends AbstractPerformanceCheck { // since 04.11.2014 (incl.) // assertEquals(71, medianSpeedup, 2.1); // +33 // since 05.12.2014 (incl.) - assertEquals(45, medianSpeedup, 2.1); // -26 + // assertEquals(45, medianSpeedup, 2.1); // -26 + // since 28.12.2014 (incl.) + assertEquals(56, medianSpeedup, 2.1); // +11 } } diff --git a/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java index a2bb94e35b648032e06d3534edde8a311ccfc9eb..5755e5cfacbae8bf58bdc159585f808074cd1ece 100644 --- a/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment10/ChwHomePerformanceCheck.java @@ -1,12 +1,13 @@ package teetime.examples.experiment10; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; class ChwHomePerformanceCheck extends AbstractPerformanceCheck { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override @@ -26,6 +27,8 @@ class ChwHomePerformanceCheck extends AbstractPerformanceCheck { // since 31.08.2014 (incl.) // assertEquals(51, medianSpeedup, 3.2); // +4 // since 13.12.2014 (incl.) - assertEquals(40, medianSpeedup, 3.2); // -11 + // assertEquals(40, medianSpeedup, 3.2); // -11 + // since 28.12.2014 (incl.) + assertEquals(24, medianSpeedup, 3.2); // -16 } } 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/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java index bab145f6ebce1b8742a2530aad145b0b12a542b7..4c89ea59b83368762ed1806ba5c80d6ea171f3b7 100644 --- a/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment14/ChwHomePerformanceCheck.java @@ -1,12 +1,13 @@ package teetime.examples.experiment14; import static org.junit.Assert.assertEquals; +import teetime.examples.HostName; class ChwHomePerformanceCheck extends AbstractPerformanceCheck { @Override public String getCorrespondingPerformanceProfile() { - return "ChwHome"; + return HostName.CHW_HOME.toString(); } @Override @@ -32,6 +33,8 @@ class ChwHomePerformanceCheck extends AbstractPerformanceCheck { // since 05.12.2014 (incl.) // assertEquals(75, medianSpeedup, 2.1); // -9 // since 13.12.2014 (incl.) - assertEquals(44, medianSpeedup, 2.1); // -31 + // 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/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/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" />