Skip to content
Snippets Groups Projects
Commit 6f9746b8 authored by Christian Wulf's avatar Christian Wulf
Browse files

added HostName enum

parent ecb6a540
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 40 deletions
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;
}
......
......@@ -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);
}
......
......@@ -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());
......
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();
}
}
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
......
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
}
}
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
}
}
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
......
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
}
}
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);
}
}
......@@ -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" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment