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

Merge branch '#18-WithoutVariants' into 'master'

#18 without variants

See merge request !1
parents 4cac156e 2c4fa2ef
No related branches found
No related tags found
No related merge requests found
Showing
with 117 additions and 619 deletions
...@@ -12,9 +12,7 @@ ...@@ -12,9 +12,7 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="conf"/> <classpathentry kind="src" path="src/performancetest/java"/>
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
...@@ -25,5 +23,8 @@ ...@@ -25,5 +23,8 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>
[submodule "submodules/JCTools"]
path = submodules/JCTools
url = https://github.com/JCTools/JCTools
teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipeFactory teetime.framework.pipe.SingleElementPipeFactory
teetime.variant.methodcallWithPorts.framework.core.pipe.OrderedGrowableArrayPipeFactory teetime.framework.pipe.OrderedGrowableArrayPipeFactory
teetime.variant.methodcallWithPorts.framework.core.pipe.UnorderedGrowablePipeFactory teetime.framework.pipe.UnorderedGrowablePipeFactory
teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipeFactory teetime.framework.pipe.SpScPipeFactory
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<build> <build>
<plugins> <plugins>
<!-- we want JDK 1.6 source and binary compatibility --> <!-- we want JDK 1.6 source and binary compatibility -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
...@@ -100,21 +101,55 @@ ...@@ -100,21 +101,55 @@
<version>2.5</version> <version>2.5</version>
</plugin> </plugin>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-shade-plugin</artifactId> --> <!-- <plugin> -->
<!-- <executions> --> <!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <execution> --> <!-- <artifactId>maven-shade-plugin</artifactId> -->
<!-- <phase>package</phase> --> <!-- <executions> -->
<!-- <goals> --> <!-- <execution> -->
<!-- <goal>shade</goal> --> <!-- <phase>package</phase> -->
<!-- </goals> --> <!-- <goals> -->
<!-- </execution> --> <!-- <goal>shade</goal> -->
<!-- </executions> --> <!-- </goals> -->
<!-- <configuration> --> <!-- </execution> -->
<!-- <finalName>${project.artifactId}-${project.version}-with-dependencies</finalName> --> <!-- </executions> -->
<!-- </configuration> --> <!-- <configuration> -->
<!-- </plugin> --> <!-- <finalName>${project.artifactId}-${project.version}-with-dependencies</finalName> -->
<!-- </configuration> -->
<!-- </plugin> -->
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>performancetest</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/performancetest/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<activation>
</activation>
</profile>
</profiles>
</project> </project>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig"> <launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/teetime/src/test/java/teetime/variant/methodcallWithPorts/examples/ComparisonMethodcallWithPorts.java"/> <listEntry value="/teetime/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java"/>
</listAttribute> </listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/> <listEntry value="1"/>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/> <stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="teetime.variant.methodcallWithPorts.examples.ComparisonMethodcallWithPorts"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="teetime.examples.ComparisonMethodcallWithPorts"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="teetime"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="teetime"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration> </launchConfiguration>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="project-info-reports:dependencies"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="-Pperformancetest test"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;folder nest=&amp;quot;false&amp;quot; path=&amp;quot;/teetime/src/perfomancetest&amp;quot;/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.folder&quot;/&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;default/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#10;&lt;/sourceContainers&gt;&#10;&lt;/sourceLookupDirector&gt;&#10;"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
</launchConfiguration>
/***************************************************************************
* 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 experiment;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import teetime.variant.explicitScheduling.framework.concurrent.StageTerminationPolicy;
import teetime.variant.explicitScheduling.framework.concurrent.WorkerThread;
import teetime.variant.explicitScheduling.framework.core.Analysis;
import teetime.variant.explicitScheduling.framework.core.IStage;
import teetime.variant.explicitScheduling.framework.core.Pipeline;
import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe;
import teetime.variant.explicitScheduling.framework.sequential.QueuePipe;
import teetime.variant.explicitScheduling.stage.NoopFilter;
import util.StatisticsUtil;
import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController;
import kieker.analysis.stage.EmptyPassOnFilter;
import kieker.analysis.stage.ObjectProducer;
import kieker.common.configuration.Configuration;
/**
* @author Nils Christian Ehmke
*
* @since 1.10
*/
public class Experiment1 {
private static final int NUMBER_OF_WARMUP_RUNS_PER_EXPERIMENT = 5;
private static final int NUMBER_OF_MEASURED_RUNS_PER_EXPERIMENT = 50;
private static final int NUMBER_OF_OBJECTS_TO_SEND = 10000;
private static final int NUMBER_OF_MINIMAL_FILTERS = 50;
private static final int NUMBER_OF_MAXIMAL_FILTERS = 1000;
private static final int NUMBER_OF_FILTERS_PER_STEP = 50;
private static final IAnalysis[] analyses = { new TeeTimeMethodCallAnalysis(), new TeeTimeAnalysis(), new KiekerAnalysis() };
private static final List<Long> measuredTimes = new ArrayList<Long>();
public static void main(final String[] args) throws Exception {
System.setProperty("kieker.common.logging.Log", "NONE");
for (final IAnalysis analysis : analyses) {
for (int numberOfFilters = NUMBER_OF_MINIMAL_FILTERS; numberOfFilters <= NUMBER_OF_MAXIMAL_FILTERS; numberOfFilters += NUMBER_OF_FILTERS_PER_STEP) {
// Warmup
for (int run = 0; run < NUMBER_OF_WARMUP_RUNS_PER_EXPERIMENT; run++) {
analysis.initialize(numberOfFilters, NUMBER_OF_OBJECTS_TO_SEND);
analysis.execute();
}
// Actual measurement
for (int run = 0; run < NUMBER_OF_MEASURED_RUNS_PER_EXPERIMENT; run++) {
final long tin = System.nanoTime();
analysis.initialize(numberOfFilters, NUMBER_OF_OBJECTS_TO_SEND);
analysis.execute();
final long tout = System.nanoTime();
Experiment1.addMeasuredTime((tout - tin));
}
Experiment1.writeAndClearMeasuredTime(analysis.getName(), numberOfFilters);
}
}
}
private static void addMeasuredTime(final long time) {
measuredTimes.add(new Long(time));
}
private static void writeAndClearMeasuredTime(final String analysisName, final int numberOfFilters) throws IOException {
final FileWriter fileWriter = new FileWriter(analysisName + ".csv", true);
fileWriter.write(Integer.toString(numberOfFilters));
fileWriter.write(";");
final Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(measuredTimes);
for (final Long value : quintiles.values()) {
fileWriter.write(Long.toString(value));
fileWriter.write(";");
}
fileWriter.write(Long.toString(StatisticsUtil.calculateAverage(measuredTimes)));
fileWriter.write(";");
fileWriter.write(Long.toString(StatisticsUtil.calculateConfidenceWidth(measuredTimes)));
fileWriter.write("\n");
fileWriter.close();
measuredTimes.clear();
}
private static interface IAnalysis {
public void initialize(int numberOfFilters, int numberOfObjectsToSend) throws Exception;
public String getName();
public void execute() throws Exception;
}
private static final class TeeTimeMethodCallAnalysis extends Analysis implements IAnalysis {
private static final int SECONDS = 1000;
private Pipeline pipeline;
private WorkerThread workerThread;
public TeeTimeMethodCallAnalysis() {}
@Override
public void initialize(final int numberOfFilters, final int numberOfObjectsToSend) {
@SuppressWarnings("unchecked")
final NoopFilter<Object>[] noopFilters = new NoopFilter[numberOfFilters];
// create stages
final teetime.variant.explicitScheduling.stage.basic.ObjectProducer<Object> objectProducer = new teetime.variant.explicitScheduling.stage.basic.ObjectProducer<Object>(
numberOfObjectsToSend, new Callable<Object>() {
@Override
public Object call() throws Exception {
return new Object();
}
});
for (int i = 0; i < noopFilters.length; i++) {
noopFilters[i] = new NoopFilter<Object>();
noopFilters[i].setSchedulable(false);
}
// add each stage to a stage list
final List<IStage> startStages = new LinkedList<IStage>();
startStages.add(objectProducer);
final List<IStage> stages = new LinkedList<IStage>();
stages.add(objectProducer);
stages.addAll(Arrays.asList(noopFilters));
// connect stages by pipes
MethodCallPipe.connect(objectProducer.outputPort, noopFilters[0].inputPort);
for (int i = 1; i < noopFilters.length; i++) {
MethodCallPipe.connect(noopFilters[i - 1].outputPort, noopFilters[i].inputPort);
}
this.pipeline = new Pipeline();
this.pipeline.setStartStages(startStages);
this.pipeline.setStages(stages);
this.workerThread = new WorkerThread(this.pipeline, 0);
this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION);
}
@Override
public String getName() {
return "TeeTimeMethodCall";
}
@Override
public void execute() {
super.start();
this.workerThread.start();
try {
this.workerThread.join(60 * SECONDS);
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
private static final class TeeTimeAnalysis extends Analysis implements IAnalysis {
private static final int SECONDS = 1000;
private Pipeline pipeline;
private WorkerThread workerThread;
public TeeTimeAnalysis() {}
@Override
public void initialize(final int numberOfFilters, final int numberOfObjectsToSend) {
@SuppressWarnings("unchecked")
final NoopFilter<Object>[] noopFilters = new NoopFilter[numberOfFilters];
// create stages
final teetime.variant.explicitScheduling.stage.basic.ObjectProducer<Object> objectProducer = new teetime.variant.explicitScheduling.stage.basic.ObjectProducer<Object>(
numberOfObjectsToSend, new Callable<Object>() {
@Override
public Object call() throws Exception {
return new Object();
}
});
for (int i = 0; i < noopFilters.length; i++) {
noopFilters[i] = new NoopFilter<Object>();
}
// add each stage to a stage list
final List<IStage> startStages = new LinkedList<IStage>();
startStages.add(objectProducer);
final List<IStage> stages = new LinkedList<IStage>();
stages.add(objectProducer);
stages.addAll(Arrays.asList(noopFilters));
// connect stages by pipes
QueuePipe.connect(objectProducer.outputPort, noopFilters[0].inputPort);
for (int i = 1; i < noopFilters.length; i++) {
QueuePipe.connect(noopFilters[i - 1].outputPort, noopFilters[i].inputPort);
}
this.pipeline = new Pipeline();
this.pipeline.setStartStages(startStages);
this.pipeline.setStages(stages);
this.workerThread = new WorkerThread(this.pipeline, 0);
this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION);
}
@Override
public String getName() {
return "TeeTime";
}
@Override
public void execute() {
super.start();
this.workerThread.start();
try {
this.workerThread.join(60 * SECONDS);
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
private static final class KiekerAnalysis implements IAnalysis {
private IAnalysisController ac;
public KiekerAnalysis() {}
@Override
public void initialize(final int numberOfFilters, final int numberOfObjectsToSend) throws Exception {
this.ac = new AnalysisController();
final Configuration producerConfig = new Configuration();
producerConfig.setProperty(ObjectProducer.CONFIG_PROPERTY_NAME_OBJECTS_TO_CREATE, Long.toString(numberOfObjectsToSend));
final ObjectProducer<Object> producer = new ObjectProducer<Object>(producerConfig, this.ac, new Callable<Object>() {
@Override
public Object call() throws Exception {
return new Object();
}
});
EmptyPassOnFilter predecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
this.ac.connect(producer, ObjectProducer.OUTPUT_PORT_NAME, predecessor, EmptyPassOnFilter.INPUT_PORT_NAME);
for (int idx = 0; idx < (numberOfFilters - 1); idx++) {
final EmptyPassOnFilter newPredecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
this.ac.connect(predecessor, EmptyPassOnFilter.OUTPUT_PORT_NAME, newPredecessor, EmptyPassOnFilter.INPUT_PORT_NAME);
predecessor = newPredecessor;
}
}
@Override
public String getName() {
return "Kieker";
}
@Override
public void execute() throws Exception {
this.ac.run();
}
}
}
/***************************************************************************
* 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 experiment;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController;
import kieker.analysis.stage.CollectorSink;
import kieker.analysis.stage.EmptyPassOnFilter;
import kieker.analysis.stage.ObjectProducer;
import kieker.analysis.stage.StartTimestampFilter;
import kieker.analysis.stage.StopTimestampFilter;
import kieker.common.configuration.Configuration;
import teetime.variant.explicitScheduling.examples.throughput.TimestampObject;
import teetime.variant.explicitScheduling.framework.concurrent.WorkerThread;
import teetime.variant.explicitScheduling.framework.core.Analysis;
import teetime.variant.explicitScheduling.framework.core.IStage;
import teetime.variant.explicitScheduling.framework.core.Pipeline;
import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe;
import teetime.variant.explicitScheduling.framework.sequential.QueuePipe;
import teetime.variant.explicitScheduling.stage.NoopFilter;
import util.StatisticsUtil;
/**
* @author Nils Christian Ehmke
*
* @since 1.10
*/
public class Experiment2 {
private static final int NUMBER_OF_WARMUP_RUNS_PER_EXPERIMENT = 5;
private static final int NUMBER_OF_MEASURED_RUNS_PER_EXPERIMENT = 50;
private static final int NUMBER_OF_OBJECTS_TO_SEND = 10000;
private static final int NUMBER_OF_MINIMAL_FILTERS = 50;
private static final int NUMBER_OF_MAXIMAL_FILTERS = 1000;
private static final int NUMBER_OF_FILTERS_PER_STEP = 50;
private static final IAnalysis[] analyses = { new TeeTimeAnalysis(true), new TeeTimeAnalysis(false), new KiekerAnalysis() };
private static final List<Long> measuredTimes = new ArrayList<Long>();
public static void main(final String[] args) throws Exception {
System.setProperty("kieker.common.logging.Log", "NONE");
for (final IAnalysis analysis : analyses) {
for (int numberOfFilters = NUMBER_OF_MINIMAL_FILTERS; numberOfFilters <= NUMBER_OF_MAXIMAL_FILTERS; numberOfFilters += NUMBER_OF_FILTERS_PER_STEP) {
// Warmup
for (int run = 0; run < NUMBER_OF_WARMUP_RUNS_PER_EXPERIMENT; run++) {
analysis.initialize(numberOfFilters, NUMBER_OF_OBJECTS_TO_SEND);
analysis.execute();
}
// Actual measurement
for (int run = 0; run < NUMBER_OF_MEASURED_RUNS_PER_EXPERIMENT; run++) {
final long tin = System.nanoTime();
analysis.initialize(numberOfFilters, NUMBER_OF_OBJECTS_TO_SEND);
analysis.execute();
final long tout = System.nanoTime();
Experiment2.addMeasuredTime((tout - tin));
}
Experiment2.writeAndClearMeasuredTime(analysis.getName(), numberOfFilters);
}
}
}
private static void addMeasuredTime(final long time) {
measuredTimes.add(new Long(time));
}
private static void writeAndClearMeasuredTime(final String analysisName, final int numberOfFilters) throws IOException {
final FileWriter fileWriter = new FileWriter(analysisName + ".csv", true);
fileWriter.write(Integer.toString(numberOfFilters));
fileWriter.write(";");
final Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(measuredTimes);
for (final Long value : quintiles.values()) {
fileWriter.write(Long.toString(value));
fileWriter.write(";");
}
fileWriter.write(Long.toString(StatisticsUtil.calculateAverage(measuredTimes)));
fileWriter.write(";");
fileWriter.write(Long.toString(StatisticsUtil.calculateConfidenceWidth(measuredTimes)));
fileWriter.write("\n");
fileWriter.close();
measuredTimes.clear();
}
private static interface IAnalysis {
public String getName();
public void execute() throws Exception;
public void initialize(int numberOfFilters, int numberOfObjectsToSend) throws Exception;
}
private static final class TeeTimeAnalysis extends Analysis implements IAnalysis {
private static final int SECONDS = 1000;
private Pipeline pipeline;
private WorkerThread workerThread;
private final boolean shouldUseQueue;
// FIXME instantiate me
private Collection<TimestampObject> timestampObjects;
public TeeTimeAnalysis(final boolean shouldUseQueue) {
this.shouldUseQueue = shouldUseQueue;
}
@Override
public void initialize(final int numberOfFilters, final int numberOfObjectsToSend) throws Exception {
@SuppressWarnings("unchecked")
final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[numberOfFilters];
// create stages
final teetime.variant.explicitScheduling.stage.basic.ObjectProducer<TimestampObject> objectProducer = new teetime.variant.explicitScheduling.stage.basic.ObjectProducer<TimestampObject>(
numberOfObjectsToSend, new Callable<TimestampObject>() {
@Override
public TimestampObject call() throws Exception {
return new TimestampObject();
}
});
final teetime.variant.explicitScheduling.stage.StartTimestampFilter startTimestampFilter = new teetime.variant.explicitScheduling.stage.StartTimestampFilter();
for (int i = 0; i < noopFilters.length; i++) {
noopFilters[i] = new NoopFilter<TimestampObject>();
}
final teetime.variant.explicitScheduling.stage.StopTimestampFilter stopTimestampFilter = new teetime.variant.explicitScheduling.stage.StopTimestampFilter();
final teetime.variant.explicitScheduling.stage.CollectorSink<TimestampObject> collectorSink = new teetime.variant.explicitScheduling.stage.CollectorSink<TimestampObject>(
this.timestampObjects);
// add each stage to a stage list
final List<IStage> startStages = new LinkedList<IStage>();
startStages.add(objectProducer);
final List<IStage> stages = new LinkedList<IStage>();
stages.add(objectProducer);
if (this.shouldUseQueue) {
stages.add(startTimestampFilter);
stages.addAll(Arrays.asList(noopFilters));
stages.add(stopTimestampFilter);
stages.add(collectorSink);
// connect stages by pipes
QueuePipe.connect(objectProducer.outputPort, startTimestampFilter.inputPort);
QueuePipe.connect(startTimestampFilter.outputPort, noopFilters[0].inputPort);
for (int i = 1; i < noopFilters.length; i++) {
QueuePipe.connect(noopFilters[i - 1].outputPort, noopFilters[i].inputPort);
}
QueuePipe.connect(noopFilters[noopFilters.length - 1].outputPort, stopTimestampFilter.inputPort);
QueuePipe.connect(stopTimestampFilter.outputPort, collectorSink.objectInputPort);
} else {
// connect stages by pipes
MethodCallPipe.connect(objectProducer.outputPort, startTimestampFilter.inputPort);
MethodCallPipe.connect(startTimestampFilter.outputPort, noopFilters[0].inputPort);
for (int i = 1; i < noopFilters.length; i++) {
MethodCallPipe.connect(noopFilters[i - 1].outputPort, noopFilters[i].inputPort);
}
MethodCallPipe.connect(noopFilters[noopFilters.length - 1].outputPort, stopTimestampFilter.inputPort);
MethodCallPipe.connect(stopTimestampFilter.outputPort, collectorSink.objectInputPort);
}
this.pipeline = new Pipeline();
this.pipeline.setStartStages(startStages);
this.pipeline.setStages(stages);
}
@Override
public String getName() {
return "TeeTime" + (this.shouldUseQueue ? "-Queues" : "-NoQueues");
}
@Override
public void execute() {
super.start();
this.workerThread.start();
try {
this.workerThread.join(60 * SECONDS);
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
private static final class KiekerAnalysis implements IAnalysis {
private IAnalysisController ac;
// FIXME instantiate me
private Collection<TimestampObject> timestampObjects;
public KiekerAnalysis() {}
@Override
public void initialize(final int numberOfFilters, final int numberOfObjectsToSend) throws Exception {
this.ac = new AnalysisController();
final Configuration producerConfig = new Configuration();
producerConfig.setProperty(ObjectProducer.CONFIG_PROPERTY_NAME_OBJECTS_TO_CREATE, Long.toString(numberOfObjectsToSend));
final ObjectProducer<TimestampObject> producer = new ObjectProducer<TimestampObject>(producerConfig, this.ac, new Callable<TimestampObject>() {
@Override
public TimestampObject call() throws Exception {
return new TimestampObject();
}
});
final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(new Configuration(), this.ac);
EmptyPassOnFilter predecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
this.ac.connect(producer, ObjectProducer.OUTPUT_PORT_NAME, startTimestampFilter, StartTimestampFilter.INPUT_PORT_NAME);
this.ac.connect(startTimestampFilter, StartTimestampFilter.OUTPUT_PORT_NAME, predecessor, EmptyPassOnFilter.INPUT_PORT_NAME);
for (int idx = 0; idx < (numberOfFilters - 1); idx++) {
final EmptyPassOnFilter newPredecessor = new EmptyPassOnFilter(new Configuration(), this.ac);
this.ac.connect(predecessor, EmptyPassOnFilter.OUTPUT_PORT_NAME, newPredecessor, EmptyPassOnFilter.INPUT_PORT_NAME);
predecessor = newPredecessor;
}
final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(new Configuration(), this.ac);
final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(new Configuration(), this.ac, this.timestampObjects);
this.ac.connect(predecessor, EmptyPassOnFilter.OUTPUT_PORT_NAME, stopTimestampFilter, StopTimestampFilter.INPUT_PORT_NAME);
this.ac.connect(stopTimestampFilter, StopTimestampFilter.OUTPUT_PORT_NAME, collectorSink, CollectorSink.INPUT_PORT_NAME);
}
@Override
public String getName() {
return "Kieker";
}
@Override
public void execute() throws Exception {
this.ac.run();
}
}
}
...@@ -18,6 +18,8 @@ package kieker.analysis.examples; ...@@ -18,6 +18,8 @@ package kieker.analysis.examples;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import teetime.util.TimestampObject;
import kieker.analysis.AnalysisController; import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController; import kieker.analysis.IAnalysisController;
import kieker.analysis.exception.AnalysisConfigurationException; import kieker.analysis.exception.AnalysisConfigurationException;
...@@ -28,11 +30,9 @@ import kieker.analysis.stage.StartTimestampFilter; ...@@ -28,11 +30,9 @@ import kieker.analysis.stage.StartTimestampFilter;
import kieker.analysis.stage.StopTimestampFilter; import kieker.analysis.stage.StopTimestampFilter;
import kieker.common.configuration.Configuration; import kieker.common.configuration.Configuration;
import teetime.variant.explicitScheduling.examples.throughput.TimestampObject;
/** /**
* @author Nils Christian Ehmke * @author Nils Christian Ehmke
* *
* @since 1.10 * @since 1.10
*/ */
public class ThroughputTimestampAnalysis { public class ThroughputTimestampAnalysis {
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
***************************************************************************/ ***************************************************************************/
package kieker.analysis.stage; package kieker.analysis.stage;
import teetime.util.TimestampObject;
import kieker.analysis.IProjectContext; import kieker.analysis.IProjectContext;
import kieker.analysis.plugin.annotation.InputPort; import kieker.analysis.plugin.annotation.InputPort;
import kieker.analysis.plugin.annotation.OutputPort; import kieker.analysis.plugin.annotation.OutputPort;
...@@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin; ...@@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.filter.AbstractFilterPlugin; import kieker.analysis.plugin.filter.AbstractFilterPlugin;
import kieker.common.configuration.Configuration; import kieker.common.configuration.Configuration;
import teetime.variant.explicitScheduling.examples.throughput.TimestampObject;
@Plugin(outputPorts = @OutputPort(name = StartTimestampFilter.OUTPUT_PORT_NAME)) @Plugin(outputPorts = @OutputPort(name = StartTimestampFilter.OUTPUT_PORT_NAME))
public class StartTimestampFilter extends AbstractFilterPlugin { public class StartTimestampFilter extends AbstractFilterPlugin {
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
***************************************************************************/ ***************************************************************************/
package kieker.analysis.stage; package kieker.analysis.stage;
import teetime.util.TimestampObject;
import kieker.analysis.IProjectContext; import kieker.analysis.IProjectContext;
import kieker.analysis.plugin.annotation.InputPort; import kieker.analysis.plugin.annotation.InputPort;
import kieker.analysis.plugin.annotation.OutputPort; import kieker.analysis.plugin.annotation.OutputPort;
...@@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin; ...@@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.filter.AbstractFilterPlugin; import kieker.analysis.plugin.filter.AbstractFilterPlugin;
import kieker.common.configuration.Configuration; import kieker.common.configuration.Configuration;
import teetime.variant.explicitScheduling.examples.throughput.TimestampObject;
@Plugin(outputPorts = @OutputPort(name = StopTimestampFilter.OUTPUT_PORT_NAME)) @Plugin(outputPorts = @OutputPort(name = StopTimestampFilter.OUTPUT_PORT_NAME))
public class StopTimestampFilter extends AbstractFilterPlugin { public class StopTimestampFilter extends AbstractFilterPlugin {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; import teetime.framework.pipe.IPipe;
public abstract class AbstractPort<T> { public abstract class AbstractPort<T> {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -9,10 +9,10 @@ import java.util.UUID; ...@@ -9,10 +9,10 @@ import java.util.UUID;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import teetime.variant.methodcallWithPorts.framework.core.pipe.DummyPipe; import teetime.framework.pipe.DummyPipe;
import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; import teetime.framework.pipe.IPipe;
import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; import teetime.framework.signal.ISignal;
import teetime.variant.methodcallWithPorts.framework.core.validation.InvalidPortConnection; import teetime.framework.validation.InvalidPortConnection;
public abstract class AbstractStage implements StageWithPort { public abstract class AbstractStage implements StageWithPort {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
import java.lang.Thread.UncaughtExceptionHandler; import java.lang.Thread.UncaughtExceptionHandler;
import java.util.Collection; import java.util.Collection;
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
public abstract class ConsumerStage<I> extends AbstractStage { public abstract class ConsumerStage<I> extends AbstractStage {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
public class HeadPipeline<FirstStage extends HeadStage, LastStage extends StageWithPort> extends Pipeline<FirstStage, LastStage> implements HeadStage { public class HeadPipeline<FirstStage extends HeadStage, LastStage extends StageWithPort> extends Pipeline<FirstStage, LastStage> implements HeadStage {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
public interface HeadStage extends StageWithPort { public interface HeadStage extends StageWithPort {
......
package teetime.variant.methodcallWithPorts.framework.core; package teetime.framework;
import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; import teetime.framework.pipe.IPipe;
public class InputPort<T> extends AbstractPort<T> { public class InputPort<T> extends AbstractPort<T> {
......
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