diff --git a/.classpath b/.classpath index fd5d7e13f5c4b051b19bdb0e7ce0b0f89060896f..9022062d8dfa64335dc564f900678538dac21bd5 100644 --- a/.classpath +++ b/.classpath @@ -12,9 +12,7 @@ <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> - <classpathentry kind="src" path="conf"/> - <classpathentry including="**/*.java" kind="src" path="src/test/resources"/> - <classpathentry including="**/*.java" kind="src" path="src/main/resources"/> + <classpathentry kind="src" path="src/performancetest/java"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="maven.pomderived" value="true"/> @@ -25,5 +23,8 @@ <attribute name="maven.pomderived" value="true"/> </attributes> </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"/> </classpath> diff --git a/.gitmodules b/.gitmodules index d563a2614c36f55e02d4de43a61b5c6a1ff662ef..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "submodules/JCTools"] - path = submodules/JCTools - url = https://github.com/JCTools/JCTools diff --git a/conf/pipe-factories.conf b/conf/pipe-factories.conf index 97c2e631b75d6b5d7c7eb9c41232512f57a3d848..50f869a06cb126ddb81847cfd8cc4681f1a63195 100644 --- a/conf/pipe-factories.conf +++ b/conf/pipe-factories.conf @@ -1,4 +1,4 @@ -teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipeFactory -teetime.variant.methodcallWithPorts.framework.core.pipe.OrderedGrowableArrayPipeFactory -teetime.variant.methodcallWithPorts.framework.core.pipe.UnorderedGrowablePipeFactory -teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipeFactory +teetime.framework.pipe.SingleElementPipeFactory +teetime.framework.pipe.OrderedGrowableArrayPipeFactory +teetime.framework.pipe.UnorderedGrowablePipeFactory +teetime.framework.pipe.SpScPipeFactory diff --git a/pom.xml b/pom.xml index 79ecfa2b947eafa8b5114a15fefeb1c1b79dfa8f..189fdb917fcc6ea055496a6bf9cd068a9ebd7f93 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,7 @@ <build> <plugins> + <!-- we want JDK 1.6 source and binary compatibility --> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -100,21 +101,55 @@ <version>2.5</version> </plugin> -<!-- <plugin> --> -<!-- <groupId>org.apache.maven.plugins</groupId> --> -<!-- <artifactId>maven-shade-plugin</artifactId> --> -<!-- <executions> --> -<!-- <execution> --> -<!-- <phase>package</phase> --> -<!-- <goals> --> -<!-- <goal>shade</goal> --> -<!-- </goals> --> -<!-- </execution> --> -<!-- </executions> --> -<!-- <configuration> --> -<!-- <finalName>${project.artifactId}-${project.version}-with-dependencies</finalName> --> -<!-- </configuration> --> -<!-- </plugin> --> + + + <!-- <plugin> --> + <!-- <groupId>org.apache.maven.plugins</groupId> --> + <!-- <artifactId>maven-shade-plugin</artifactId> --> + <!-- <executions> --> + <!-- <execution> --> + <!-- <phase>package</phase> --> + <!-- <goals> --> + <!-- <goal>shade</goal> --> + <!-- </goals> --> + <!-- </execution> --> + <!-- </executions> --> + <!-- <configuration> --> + <!-- <finalName>${project.artifactId}-${project.version}-with-dependencies</finalName> --> + <!-- </configuration> --> + <!-- </plugin> --> </plugins> </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> diff --git a/run-configurations/ComparisonMethodcallWithPorts.launch b/run-configurations/ComparisonMethodcallWithPorts.launch index d45df6276b6c86e5c3f494f27c216941bc935a01..c5391996699e84d0ac1ab95bb6495293d3efdb62 100644 --- a/run-configurations/ComparisonMethodcallWithPorts.launch +++ b/run-configurations/ComparisonMethodcallWithPorts.launch @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <launchConfiguration type="org.eclipse.jdt.junit.launchconfig"> <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 key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listEntry value="1"/> @@ -12,7 +12,7 @@ <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"/> <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.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/> </launchConfiguration> diff --git a/run-configurations/maven-listdependencies.launch b/run-configurations/maven-listdependencies.launch new file mode 100644 index 0000000000000000000000000000000000000000..43aac7069058a7056ee0b40a572baa4f803735a6 --- /dev/null +++ b/run-configurations/maven-listdependencies.launch @@ -0,0 +1,17 @@ +<?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> diff --git a/run-configurations/maven-test.launch b/run-configurations/maven-test.launch new file mode 100644 index 0000000000000000000000000000000000000000..0fb01690bd5f205664275114b5e59e383374db73 --- /dev/null +++ b/run-configurations/maven-test.launch @@ -0,0 +1,19 @@ +<?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="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;folder nest=&quot;false&quot; path=&quot;/teetime/src/perfomancetest&quot;/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.folder"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;default/&gt;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/> +<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> diff --git a/src/main/java/experiment/Experiment1.java b/src/main/java/experiment/Experiment1.java deleted file mode 100644 index 8793f7d0dc37ca90226294f03b909add8b241ee9..0000000000000000000000000000000000000000 --- a/src/main/java/experiment/Experiment1.java +++ /dev/null @@ -1,301 +0,0 @@ -/*************************************************************************** - * 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(); - } - - } - -} diff --git a/src/main/java/experiment/Experiment2.java b/src/main/java/experiment/Experiment2.java deleted file mode 100644 index 8f48855855ed772dfa68ebf41f9c730fa423924f..0000000000000000000000000000000000000000 --- a/src/main/java/experiment/Experiment2.java +++ /dev/null @@ -1,270 +0,0 @@ -/*************************************************************************** - * 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(); - } - - } - -} diff --git a/src/main/java/kieker/analysis/examples/ThroughputTimestampAnalysis.java b/src/main/java/kieker/analysis/examples/ThroughputTimestampAnalysis.java index 83924f8ce3c8955f511fc822a393112b9bcb691f..f06b4e175ba4e0670f2501004dc2dc68df0e07a3 100644 --- a/src/main/java/kieker/analysis/examples/ThroughputTimestampAnalysis.java +++ b/src/main/java/kieker/analysis/examples/ThroughputTimestampAnalysis.java @@ -18,6 +18,8 @@ package kieker.analysis.examples; import java.util.Collection; import java.util.concurrent.Callable; +import teetime.util.TimestampObject; + import kieker.analysis.AnalysisController; import kieker.analysis.IAnalysisController; import kieker.analysis.exception.AnalysisConfigurationException; @@ -28,11 +30,9 @@ import kieker.analysis.stage.StartTimestampFilter; import kieker.analysis.stage.StopTimestampFilter; import kieker.common.configuration.Configuration; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; - /** * @author Nils Christian Ehmke - * + * * @since 1.10 */ public class ThroughputTimestampAnalysis { diff --git a/src/main/java/kieker/analysis/stage/StartTimestampFilter.java b/src/main/java/kieker/analysis/stage/StartTimestampFilter.java index 0daf1ad56a72d3b9669bf2d0435fd3501cd72e9b..c82b0ff6d4c93d30b58498c468884257e245729d 100644 --- a/src/main/java/kieker/analysis/stage/StartTimestampFilter.java +++ b/src/main/java/kieker/analysis/stage/StartTimestampFilter.java @@ -15,6 +15,8 @@ ***************************************************************************/ package kieker.analysis.stage; +import teetime.util.TimestampObject; + import kieker.analysis.IProjectContext; import kieker.analysis.plugin.annotation.InputPort; import kieker.analysis.plugin.annotation.OutputPort; @@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin; import kieker.analysis.plugin.filter.AbstractFilterPlugin; import kieker.common.configuration.Configuration; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; - @Plugin(outputPorts = @OutputPort(name = StartTimestampFilter.OUTPUT_PORT_NAME)) public class StartTimestampFilter extends AbstractFilterPlugin { diff --git a/src/main/java/kieker/analysis/stage/StopTimestampFilter.java b/src/main/java/kieker/analysis/stage/StopTimestampFilter.java index db723d7b5aa9b916bacb6373f64efaa3507d1522..77eeb95c4a94e904da9c6ed45bff43c8e60f3e34 100644 --- a/src/main/java/kieker/analysis/stage/StopTimestampFilter.java +++ b/src/main/java/kieker/analysis/stage/StopTimestampFilter.java @@ -15,6 +15,8 @@ ***************************************************************************/ package kieker.analysis.stage; +import teetime.util.TimestampObject; + import kieker.analysis.IProjectContext; import kieker.analysis.plugin.annotation.InputPort; import kieker.analysis.plugin.annotation.OutputPort; @@ -22,8 +24,6 @@ import kieker.analysis.plugin.annotation.Plugin; import kieker.analysis.plugin.filter.AbstractFilterPlugin; import kieker.common.configuration.Configuration; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; - @Plugin(outputPorts = @OutputPort(name = StopTimestampFilter.OUTPUT_PORT_NAME)) public class StopTimestampFilter extends AbstractFilterPlugin { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractPort.java b/src/main/java/teetime/framework/AbstractPort.java similarity index 77% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractPort.java rename to src/main/java/teetime/framework/AbstractPort.java index 53aed08c7ab95c848e4721fe116a0ced45cb61af..29568b17620b6b0c87d84ccde40c724cb96be833 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractPort.java +++ b/src/main/java/teetime/framework/AbstractPort.java @@ -1,6 +1,6 @@ -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> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java b/src/main/java/teetime/framework/AbstractStage.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java rename to src/main/java/teetime/framework/AbstractStage.java index a2bd9887df5f89555ed65e49450cbfddd0b31891..53ed24f01f44e8a7d3a6693978c826625a58efac 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java +++ b/src/main/java/teetime/framework/AbstractStage.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import java.util.ArrayList; import java.util.HashMap; @@ -9,10 +9,10 @@ import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.DummyPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; -import teetime.variant.methodcallWithPorts.framework.core.validation.InvalidPortConnection; +import teetime.framework.pipe.DummyPipe; +import teetime.framework.pipe.IPipe; +import teetime.framework.signal.ISignal; +import teetime.framework.validation.InvalidPortConnection; public abstract class AbstractStage implements StageWithPort { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Analysis.java b/src/main/java/teetime/framework/Analysis.java similarity index 97% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/Analysis.java rename to src/main/java/teetime/framework/Analysis.java index 785751161c7a78460b7509615a401b4227067940..c9fd8e112c7a8cfb9e2be4f2df0de17ac660054b 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Analysis.java +++ b/src/main/java/teetime/framework/Analysis.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import java.lang.Thread.UncaughtExceptionHandler; import java.util.Collection; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AnalysisConfiguration.java b/src/main/java/teetime/framework/AnalysisConfiguration.java similarity index 91% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/AnalysisConfiguration.java rename to src/main/java/teetime/framework/AnalysisConfiguration.java index 158cb892f5c59cced61467ffb83f6b866039a96f..1a291c2e54dacc5b376b0a2420f064c9e741acd3 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AnalysisConfiguration.java +++ b/src/main/java/teetime/framework/AnalysisConfiguration.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/ConsumerStage.java b/src/main/java/teetime/framework/ConsumerStage.java similarity index 87% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/ConsumerStage.java rename to src/main/java/teetime/framework/ConsumerStage.java index 36c4893b3f937be74bd2553a13bc730607e447a6..769ca731e8a0cca2d0467b54ce2ea7124e396b16 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/ConsumerStage.java +++ b/src/main/java/teetime/framework/ConsumerStage.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; public abstract class ConsumerStage<I> extends AbstractStage { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadPipeline.java b/src/main/java/teetime/framework/HeadPipeline.java similarity index 86% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadPipeline.java rename to src/main/java/teetime/framework/HeadPipeline.java index 2f57679e884929f69a866e9ea7003fbabf7e7eb0..3c9dd13940f4cde35f0d1d900daa3fd944e4ef9a 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadPipeline.java +++ b/src/main/java/teetime/framework/HeadPipeline.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; public class HeadPipeline<FirstStage extends HeadStage, LastStage extends StageWithPort> extends Pipeline<FirstStage, LastStage> implements HeadStage { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadStage.java b/src/main/java/teetime/framework/HeadStage.java similarity index 63% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadStage.java rename to src/main/java/teetime/framework/HeadStage.java index 2c80f08c4adfeb83b27ce5eb094a98e663d614d2..373b150d171b713863ee2c061ba34170b1fd35d3 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/HeadStage.java +++ b/src/main/java/teetime/framework/HeadStage.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; public interface HeadStage extends StageWithPort { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/InputPort.java b/src/main/java/teetime/framework/InputPort.java similarity index 84% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/InputPort.java rename to src/main/java/teetime/framework/InputPort.java index be4ed828fb87382299a64fd598b291a813aeeb5c..f221f51104419ef5fd6dd16a0ad9b03f07215bd3 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/InputPort.java +++ b/src/main/java/teetime/framework/InputPort.java @@ -1,6 +1,6 @@ -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> { diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/Analysis.java b/src/main/java/teetime/framework/OldAnalysis.java similarity index 92% rename from src/main/java/teetime/variant/explicitScheduling/framework/core/Analysis.java rename to src/main/java/teetime/framework/OldAnalysis.java index 8b147e41c6c57c77569cfe9125a5885fc033424a..914c52b84cfdb8be535302b75b359afaba654e15 100644 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/Analysis.java +++ b/src/main/java/teetime/framework/OldAnalysis.java @@ -14,14 +14,15 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.framework.core; +package teetime.framework; /** * @author Christian Wulf * * @since 1.10 */ -public class Analysis { +@Deprecated +public class OldAnalysis { public void init() { System.out.println("Analysis initialized."); diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/OutputPort.java b/src/main/java/teetime/framework/OutputPort.java similarity index 78% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/OutputPort.java rename to src/main/java/teetime/framework/OutputPort.java index 790aa531350e77a7584fa72a54d9cea6244b8dea..e53b5aff33ed13d841d4fee88a175ef5610827ae 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/OutputPort.java +++ b/src/main/java/teetime/framework/OutputPort.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.signal.ISignal; public final class OutputPort<T> extends AbstractPort<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java b/src/main/java/teetime/framework/Pipeline.java similarity index 85% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java rename to src/main/java/teetime/framework/Pipeline.java index d44473d72cebab905430450d473ce6050d20f6f0..91b0ae866ecd9b073e1097e7be404bc7b2dfc812 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java +++ b/src/main/java/teetime/framework/Pipeline.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; -import teetime.variant.methodcallWithPorts.framework.core.validation.InvalidPortConnection; +import teetime.framework.signal.ISignal; +import teetime.framework.validation.InvalidPortConnection; public class Pipeline<FirstStage extends StageWithPort, LastStage extends StageWithPort> implements StageWithPort { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/ProducerStage.java b/src/main/java/teetime/framework/ProducerStage.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/ProducerStage.java rename to src/main/java/teetime/framework/ProducerStage.java index 48cb06fb08ff791454555e62f7ac991ee362dd40..5ef9c813a0eb26cbb58396a9991050b3b256691e 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/ProducerStage.java +++ b/src/main/java/teetime/framework/ProducerStage.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; /** * The <code>ProducerStage</code> produces at least one element at each execution.<br> diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java b/src/main/java/teetime/framework/RunnableStage.java similarity index 79% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java rename to src/main/java/teetime/framework/RunnableStage.java index 22a95ff654035fe3786b888a48536122394c806b..a22400157a53056e6599f4a935772cbebbf751a7 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/RunnableStage.java +++ b/src/main/java/teetime/framework/RunnableStage.java @@ -1,12 +1,12 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import teetime.variant.methodcallWithPorts.framework.core.signal.StartingSignal; -import teetime.variant.methodcallWithPorts.framework.core.signal.TerminatingSignal; -import teetime.variant.methodcallWithPorts.framework.core.signal.ValidatingSignal; -import teetime.variant.methodcallWithPorts.framework.core.validation.AnalysisNotValidException; +import teetime.framework.signal.StartingSignal; +import teetime.framework.signal.TerminatingSignal; +import teetime.framework.signal.ValidatingSignal; +import teetime.framework.validation.AnalysisNotValidException; public class RunnableStage implements Runnable { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/StageWithPort.java b/src/main/java/teetime/framework/StageWithPort.java similarity index 71% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/StageWithPort.java rename to src/main/java/teetime/framework/StageWithPort.java index b315a0006d73a95bc9ada9bf65119cf8c671f8bd..281b9485ea5476b4d183e7fb2402f616050550a6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/StageWithPort.java +++ b/src/main/java/teetime/framework/StageWithPort.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core; +package teetime.framework; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; -import teetime.variant.methodcallWithPorts.framework.core.validation.InvalidPortConnection; +import teetime.framework.signal.ISignal; +import teetime.framework.validation.InvalidPortConnection; public interface StageWithPort { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/AbstractPipe.java b/src/main/java/teetime/framework/pipe/AbstractPipe.java similarity index 80% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/AbstractPipe.java rename to src/main/java/teetime/framework/pipe/AbstractPipe.java index d34fd86080e18e7936813bc8fdf0e6ee24606a82..c89cd96408e16fc6aed56424adc0237a7ffa2a18 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/AbstractPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractPipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.StageWithPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.StageWithPort; public abstract class AbstractPipe implements IPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CommittablePipe.java b/src/main/java/teetime/framework/pipe/CommittablePipe.java similarity index 88% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CommittablePipe.java rename to src/main/java/teetime/framework/pipe/CommittablePipe.java index 2badc2ea6117cd94c8a2e840fd737e6bdcbe3ac8..fddb53c613ca5b31e7acca6a572576a41289b6c8 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CommittablePipe.java +++ b/src/main/java/teetime/framework/pipe/CommittablePipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; import teetime.util.list.CommittableResizableArrayQueue; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; public final class CommittablePipe extends IntraThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CouldNotFindPipeImplException.java b/src/main/java/teetime/framework/pipe/CouldNotFindPipeImplException.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CouldNotFindPipeImplException.java rename to src/main/java/teetime/framework/pipe/CouldNotFindPipeImplException.java index 4cc05179a806c8727bfb3c35a6488bf70385b88a..ed80b4dc131721b176b298681784280da7e6b54f 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/CouldNotFindPipeImplException.java +++ b/src/main/java/teetime/framework/pipe/CouldNotFindPipeImplException.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; public class CouldNotFindPipeImplException extends RuntimeException { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/DummyPipe.java b/src/main/java/teetime/framework/pipe/DummyPipe.java similarity index 73% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/DummyPipe.java rename to src/main/java/teetime/framework/pipe/DummyPipe.java index aa27ebbdf9d5ece5fe81513c83d595ae7fe04e09..98629184ddedf7555193be0167ec371b018a6427 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/DummyPipe.java +++ b/src/main/java/teetime/framework/pipe/DummyPipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.signal.ISignal; /** * A pipe implementation used to connect unconnected output ports. diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipe.java b/src/main/java/teetime/framework/pipe/IPipe.java similarity index 54% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipe.java rename to src/main/java/teetime/framework/pipe/IPipe.java index 154ac92334e24ecf9dae3fe81686d91558cdfacf..1e9d2f4399430b35c7eb8e0efeb2a089529058b7 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipe.java +++ b/src/main/java/teetime/framework/pipe/IPipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.signal.ISignal; public interface IPipe { diff --git a/src/main/java/teetime/framework/pipe/IPipeFactory.java b/src/main/java/teetime/framework/pipe/IPipeFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..b3fde09beb90469b2d47fcb22967a72f6451c494 --- /dev/null +++ b/src/main/java/teetime/framework/pipe/IPipeFactory.java @@ -0,0 +1,23 @@ +package teetime.framework.pipe; + +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; + +public interface IPipeFactory { + + @Deprecated + IPipe create(int capacity); + + <T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort); + + <T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort, int capacity); + + ThreadCommunication getThreadCommunication(); + + PipeOrdering getOrdering(); + + boolean isGrowable(); + +} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/InterThreadPipe.java b/src/main/java/teetime/framework/pipe/InterThreadPipe.java similarity index 68% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/InterThreadPipe.java rename to src/main/java/teetime/framework/pipe/InterThreadPipe.java index 7c2ede98b1a4875d7085083634cb482c0667a4d6..377b01b181eda99dad0c09a9633f817d1fc7da8e 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/InterThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/InterThreadPipe.java @@ -1,10 +1,10 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import java.util.concurrent.atomic.AtomicReference; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.signal.ISignal; public abstract class InterThreadPipe extends AbstractPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IntraThreadPipe.java b/src/main/java/teetime/framework/pipe/IntraThreadPipe.java similarity index 65% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IntraThreadPipe.java rename to src/main/java/teetime/framework/pipe/IntraThreadPipe.java index e34547b0b08802a62ef8e5e90f58f44491f35c52..27a7aa2adae1b0755acf2a6e0b5193df066c7974 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IntraThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/IntraThreadPipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.signal.ISignal; public abstract class IntraThreadPipe extends AbstractPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java similarity index 85% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipe.java rename to src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java index e059acd4ccaffb831004703475c863593bab1d53..5ee042d070bb0c95a45470d6fbaab52cdda411d3 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; import teetime.util.concurrent.workstealing.CircularArray; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; public final class OrderedGrowableArrayPipe extends IntraThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipeFactory.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java similarity index 67% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipeFactory.java rename to src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java index 7290a7821ae5558b04e2b9675848875affd959c6..76f17f5d48014dbb4a1a66e6eadb80eee92c7ca4 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowableArrayPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; public class OrderedGrowableArrayPipeFactory implements IPipeFactory { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java similarity index 82% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowablePipe.java rename to src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java index eab5df8f182e646d43d56c520b6c92467c9ebfc5..0163ba6a72f43d9a3c179643643bd88fd77693ce 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/OrderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import java.util.LinkedList; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public class OrderedGrowablePipe extends IntraThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactory.java b/src/main/java/teetime/framework/pipe/PipeFactory.java similarity index 97% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactory.java rename to src/main/java/teetime/framework/pipe/PipeFactory.java index 20fbec00a613e57386db382d9fec2b2d0295feac..57de4c11117a63d8a8317e92f9a4c75e3f67ab9c 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactory.java +++ b/src/main/java/teetime/framework/pipe/PipeFactory.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import java.io.IOException; import java.util.HashMap; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactoryLoader.java b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java similarity index 95% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactoryLoader.java rename to src/main/java/teetime/framework/pipe/PipeFactoryLoader.java index df1b844ffb086e4ddaccdc40b45f720081c72e1e..365918f0421275421c294533d8d99832e89b3fc2 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/PipeFactoryLoader.java +++ b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import java.io.BufferedReader; import java.io.FileReader; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/RelayTestPipe.java b/src/main/java/teetime/framework/pipe/RelayTestPipe.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/RelayTestPipe.java rename to src/main/java/teetime/framework/pipe/RelayTestPipe.java index 26e8da0505d110b44b36265d66767a94f3908874..9950af66e27f0b6487cdd8fcd504bb7e49ebb5b3 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/RelayTestPipe.java +++ b/src/main/java/teetime/framework/pipe/RelayTestPipe.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import teetime.util.ConstructorClosure; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipe.java b/src/main/java/teetime/framework/pipe/SingleElementPipe.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipe.java rename to src/main/java/teetime/framework/pipe/SingleElementPipe.java index f40eca65363d308b1a71d817e0843df351b9735d..bccc7c9c9adc8331756a756de43994490416669d 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipe.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipe.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public final class SingleElementPipe extends IntraThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipeFactory.java b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java similarity index 69% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipeFactory.java rename to src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java index 22309e35f5f3696a76b115e174266f2195b3bfdd..ee8d3cf499fd6b11456fd43198895afa41cac0f2 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SingleElementPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; public class SingleElementPipeFactory implements IPipeFactory { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipe.java b/src/main/java/teetime/framework/pipe/SpScPipe.java similarity index 87% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipe.java rename to src/main/java/teetime/framework/pipe/SpScPipe.java index acb1cc62026574ceb4e08a54e9147435b12c9a3a..329e4cff5fab0a03a279e74c38c764cd9fb344b6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipe.java +++ b/src/main/java/teetime/framework/pipe/SpScPipe.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; import java.util.Queue; @@ -7,8 +7,8 @@ import org.jctools.queues.spec.ConcurrentQueueSpec; import org.jctools.queues.spec.Ordering; import org.jctools.queues.spec.Preference; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public final class SpScPipe extends InterThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipeFactory.java b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java similarity index 66% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipeFactory.java rename to src/main/java/teetime/framework/pipe/SpScPipeFactory.java index fa0686e264ea2dfcf21249d8c7811d2f7c836039..25331aa398d0955c2bfd7d34eef94ce4fd924743 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/SpScPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; public class SpScPipeFactory implements IPipeFactory { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java similarity index 91% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipe.java rename to src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java index 878844e28a1073c5a544656a8f24781b8efd4c90..be8c15457d84011d74606abd0e420500307c06e0 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public final class UnorderedGrowablePipe extends IntraThreadPipe { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipeFactory.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java similarity index 68% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipeFactory.java rename to src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java index 536efc0ceee774f6652b3cd3f9a68524a27077d5..e18e896d1d4903cf61407fdb70e75cb6a1ba9211 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/UnorderedGrowablePipeFactory.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; +package teetime.framework.pipe; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; public class UnorderedGrowablePipeFactory implements IPipeFactory { diff --git a/src/main/java/teetime/framework/signal/ISignal.java b/src/main/java/teetime/framework/signal/ISignal.java new file mode 100644 index 0000000000000000000000000000000000000000..b94fc752315db55b1ebcdc58f7d21f6a7db10130 --- /dev/null +++ b/src/main/java/teetime/framework/signal/ISignal.java @@ -0,0 +1,8 @@ +package teetime.framework.signal; + +import teetime.framework.AbstractStage; + +public interface ISignal { + + void trigger(AbstractStage stage); +} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/StartingSignal.java b/src/main/java/teetime/framework/signal/StartingSignal.java similarity index 50% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/StartingSignal.java rename to src/main/java/teetime/framework/signal/StartingSignal.java index 11dc8c725de1a26d08e1d07598004cdea91dcbc1..d1b7aa5474236f782e6b8436f9934ed87149e9f6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/StartingSignal.java +++ b/src/main/java/teetime/framework/signal/StartingSignal.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.framework.core.signal; +package teetime.framework.signal; -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; +import teetime.framework.AbstractStage; public class StartingSignal implements ISignal { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/TerminatingSignal.java b/src/main/java/teetime/framework/signal/TerminatingSignal.java similarity index 51% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/TerminatingSignal.java rename to src/main/java/teetime/framework/signal/TerminatingSignal.java index 1c523522c3108c463f139941e572a2e731ea6727..0aba57bae09d4045d6d76163c86a108206a8d660 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/TerminatingSignal.java +++ b/src/main/java/teetime/framework/signal/TerminatingSignal.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.framework.core.signal; +package teetime.framework.signal; -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; +import teetime.framework.AbstractStage; public class TerminatingSignal implements ISignal { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ValidatingSignal.java b/src/main/java/teetime/framework/signal/ValidatingSignal.java similarity index 65% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ValidatingSignal.java rename to src/main/java/teetime/framework/signal/ValidatingSignal.java index 3b9cd6840fe8ceb59ca3715b2c22b59fe6c200be..2b4858ca45b3ee1d34ec11ecf4f8eb725536bb79 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ValidatingSignal.java +++ b/src/main/java/teetime/framework/signal/ValidatingSignal.java @@ -1,10 +1,10 @@ -package teetime.variant.methodcallWithPorts.framework.core.signal; +package teetime.framework.signal; import java.util.LinkedList; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; -import teetime.variant.methodcallWithPorts.framework.core.validation.InvalidPortConnection; +import teetime.framework.AbstractStage; +import teetime.framework.validation.InvalidPortConnection; public class ValidatingSignal implements ISignal { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/AnalysisNotValidException.java b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java similarity index 91% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/AnalysisNotValidException.java rename to src/main/java/teetime/framework/validation/AnalysisNotValidException.java index 7fd84f20793d5612296af1beb035e3ebd06a52cb..a827d7f14eb5070fc552321d6805aeeb3853441b 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/AnalysisNotValidException.java +++ b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.framework.core.validation; +package teetime.framework.validation; import java.util.List; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/InvalidPortConnection.java b/src/main/java/teetime/framework/validation/InvalidPortConnection.java similarity index 78% rename from src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/InvalidPortConnection.java rename to src/main/java/teetime/framework/validation/InvalidPortConnection.java index de60a0a40e9e2a9d4c0ab22adc85dbf0806fe17d..183f3700a757c8310ab54fee545742e3bd5fa4e7 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/validation/InvalidPortConnection.java +++ b/src/main/java/teetime/framework/validation/InvalidPortConnection.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.framework.core.validation; +package teetime.framework.validation; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public class InvalidPortConnection { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/Cache.java b/src/main/java/teetime/stage/Cache.java similarity index 82% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/Cache.java rename to src/main/java/teetime/stage/Cache.java index ea9bb2e9660b53e7b6f17721e321c204d159f304..44588ceb2a085eba4f9c4b83145df1c637047c96 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/Cache.java +++ b/src/main/java/teetime/stage/Cache.java @@ -1,12 +1,12 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; import teetime.util.StopWatch; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; public class Cache<T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/Clock.java b/src/main/java/teetime/stage/Clock.java similarity index 89% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/Clock.java rename to src/main/java/teetime/stage/Clock.java index e140fed534db7c90f00c1e970176a57340f2d6ca..e9439886d9c0ac1d5df7d225d43ec46cb49d753f 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/Clock.java +++ b/src/main/java/teetime/stage/Clock.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; public class Clock extends ProducerStage<Long> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/CollectorSink.java b/src/main/java/teetime/stage/CollectorSink.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/CollectorSink.java rename to src/main/java/teetime/stage/CollectorSink.java index 6af3d421f4d30a73c0289960b94ecb033d587ec0..33d4b434cef61cfef3b1f6633ea64795d009a537 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/CollectorSink.java +++ b/src/main/java/teetime/stage/CollectorSink.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; +import teetime.framework.ConsumerStage; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/Counter.java b/src/main/java/teetime/stage/Counter.java similarity index 74% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/Counter.java rename to src/main/java/teetime/stage/Counter.java index 88b446f00520cf29c130ff90a7a41caca0de31f9..7d3d8c9510eba5e774e66c8b2ed7009964344791 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/Counter.java +++ b/src/main/java/teetime/stage/Counter.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; public class Counter<T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/ElementDelayMeasuringStage.java b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java similarity index 85% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/ElementDelayMeasuringStage.java rename to src/main/java/teetime/stage/ElementDelayMeasuringStage.java index 2ab1fa47f75153d79de9db1a68db054d32d8b654..452f75e3701d2bb29e74e156b152c5df1156d82f 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/ElementDelayMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java @@ -1,11 +1,11 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; import java.util.LinkedList; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public class ElementDelayMeasuringStage<T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/ElementThroughputMeasuringStage.java b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java similarity index 89% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/ElementThroughputMeasuringStage.java rename to src/main/java/teetime/stage/ElementThroughputMeasuringStage.java index 33ad7d5fb4fc544da48cefead2f003084879fcdc..ea36801a4d4ccbb07868f9582f2fdaab7837f7a9 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/ElementThroughputMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java @@ -1,12 +1,12 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public class ElementThroughputMeasuringStage<T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/FileExtensionSwitch.java b/src/main/java/teetime/stage/FileExtensionSwitch.java similarity index 83% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/FileExtensionSwitch.java rename to src/main/java/teetime/stage/FileExtensionSwitch.java index 235cd3608dd5c5cee966b45e8e554ac5c7f6cd1e..da6099938b7876542b9a3a736d43944157b7d264 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/FileExtensionSwitch.java +++ b/src/main/java/teetime/stage/FileExtensionSwitch.java @@ -1,11 +1,11 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; import java.io.File; import java.util.HashMap; import java.util.Map; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; import com.google.common.io.Files; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/InitialElementProducer.java b/src/main/java/teetime/stage/InitialElementProducer.java similarity index 71% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/InitialElementProducer.java rename to src/main/java/teetime/stage/InitialElementProducer.java index 8a303610ad4d2af4b69242d2cca45a1c875b1698..a5084ce6e6ddca36edb8dbf4f70b5fe19b65022f 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/InitialElementProducer.java +++ b/src/main/java/teetime/stage/InitialElementProducer.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; public class InitialElementProducer<T> extends ProducerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceCounter.java b/src/main/java/teetime/stage/InstanceCounter.java similarity index 73% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceCounter.java rename to src/main/java/teetime/stage/InstanceCounter.java index 7e5652fc89d2b84ae37f82ca4f50c1b309b4705c..30df6693b7d42bfddf88b994c4ec69a6daffba30 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceCounter.java +++ b/src/main/java/teetime/stage/InstanceCounter.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; public class InstanceCounter<T, C extends T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceOfFilter.java b/src/main/java/teetime/stage/InstanceOfFilter.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceOfFilter.java rename to src/main/java/teetime/stage/InstanceOfFilter.java index 79596765a99cf8f56c61f9f5490e6e5c0c9a9645..042febae604acfc6d32827dde25ccf24fe0794ad 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/InstanceOfFilter.java +++ b/src/main/java/teetime/stage/InstanceOfFilter.java @@ -1,7 +1,7 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; /** * @author Jan Waller, Nils Christian Ehmke, Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/NoopFilter.java b/src/main/java/teetime/stage/NoopFilter.java similarity index 85% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/NoopFilter.java rename to src/main/java/teetime/stage/NoopFilter.java index 385e4cbfc52c0e457b08b6146a7779d898c1674d..4a7211520fa5d367629631257011f1bce65cdbfd 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/NoopFilter.java +++ b/src/main/java/teetime/stage/NoopFilter.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/ObjectProducer.java b/src/main/java/teetime/stage/ObjectProducer.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/ObjectProducer.java rename to src/main/java/teetime/stage/ObjectProducer.java index 663c83ecf2e4e9118810f0388f8b1dbaf138a70e..f3787ac6283f6f1613bda9af55e09923b36d17c5 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/ObjectProducer.java +++ b/src/main/java/teetime/stage/ObjectProducer.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; +import teetime.framework.ProducerStage; import teetime.util.ConstructorClosure; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/PortTypeConfiguration.java b/src/main/java/teetime/stage/PortTypeConfiguration.java similarity index 79% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/PortTypeConfiguration.java rename to src/main/java/teetime/stage/PortTypeConfiguration.java index 59790ddd8fb52c24687d4e1f469837c045fd64bf..00b9cad4fdb5fe6d156941c6ddf9d271a12c5b60 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/PortTypeConfiguration.java +++ b/src/main/java/teetime/stage/PortTypeConfiguration.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; public class PortTypeConfiguration { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java b/src/main/java/teetime/stage/Relay.java similarity index 64% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java rename to src/main/java/teetime/stage/Relay.java index b40d462835d133237362f5366bbb756cb685a70a..144b34eaf9d0e6dd7f611b54aa3df28f21e14a00 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/Relay.java +++ b/src/main/java/teetime/stage/Relay.java @@ -1,9 +1,9 @@ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.InterThreadPipe; -import teetime.variant.methodcallWithPorts.framework.core.signal.TerminatingSignal; +import teetime.framework.InputPort; +import teetime.framework.ProducerStage; +import teetime.framework.pipe.InterThreadPipe; +import teetime.framework.signal.TerminatingSignal; public class Relay<T> extends ProducerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/StartTimestampFilter.java b/src/main/java/teetime/stage/StartTimestampFilter.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/StartTimestampFilter.java rename to src/main/java/teetime/stage/StartTimestampFilter.java index 0ba688d7f3da6f214189e5e7d5e1e39e8d241f69..b3ecfe3c06265ac29aab8fda47213b73e0be04ce 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/StartTimestampFilter.java +++ b/src/main/java/teetime/stage/StartTimestampFilter.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.util.TimestampObject; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/StopTimestampFilter.java b/src/main/java/teetime/stage/StopTimestampFilter.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/StopTimestampFilter.java rename to src/main/java/teetime/stage/StopTimestampFilter.java index c8454c2f35bfb2ec49fe9bb8a8028c2e88585035..9dff2cf0f067f49847fb241ac8e1fb9636f6926a 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/StopTimestampFilter.java +++ b/src/main/java/teetime/stage/StopTimestampFilter.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage; +package teetime.stage; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.util.TimestampObject; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Delay.java b/src/main/java/teetime/stage/basic/Delay.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Delay.java rename to src/main/java/teetime/stage/basic/Delay.java index 55ee676c01c7986604fbd14af439608c4c24590b..1804def32735e94ea0a68a186f55748ce5e4f102 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Delay.java +++ b/src/main/java/teetime/stage/basic/Delay.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.stage.basic; +package teetime.stage.basic; -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.AbstractStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; public class Delay<T> extends AbstractStage { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Sink.java b/src/main/java/teetime/stage/basic/Sink.java similarity index 67% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Sink.java rename to src/main/java/teetime/stage/basic/Sink.java index b9e0bca2d124287f6c6afdc5e2123e61bc6481e2..e5c5d722ff518d0e776f469ffd600a93cc4ed345 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/Sink.java +++ b/src/main/java/teetime/stage/basic/Sink.java @@ -1,6 +1,6 @@ -package teetime.variant.methodcallWithPorts.stage.basic; +package teetime.stage.basic; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; +import teetime.framework.ConsumerStage; public class Sink<T> extends ConsumerStage<T> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CloneStrategy.java b/src/main/java/teetime/stage/basic/distributor/CloneStrategy.java similarity index 88% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CloneStrategy.java rename to src/main/java/teetime/stage/basic/distributor/CloneStrategy.java index 5ad9ab05f7d858b63239dd752404bb06ae2f86d6..9512aad0c39eee4528916429423b23bad95ab199 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CloneStrategy.java +++ b/src/main/java/teetime/stage/basic/distributor/CloneStrategy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.distributor; +package teetime.stage.basic.distributor; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.OutputPort; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CopyByReferenceStrategy.java b/src/main/java/teetime/stage/basic/distributor/CopyByReferenceStrategy.java similarity index 88% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CopyByReferenceStrategy.java rename to src/main/java/teetime/stage/basic/distributor/CopyByReferenceStrategy.java index 9445ae972f262cb23a3f7b7aaa023aeac075a239..d5f2697228bbfc7851057eae82e24fa71fe92bcb 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/CopyByReferenceStrategy.java +++ b/src/main/java/teetime/stage/basic/distributor/CopyByReferenceStrategy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.distributor; +package teetime.stage.basic.distributor; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.OutputPort; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/Distributor.java b/src/main/java/teetime/stage/basic/distributor/Distributor.java similarity index 88% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/Distributor.java rename to src/main/java/teetime/stage/basic/distributor/Distributor.java index 10c74c11e9d40a1ef10aa15e0a5f353ed0262343..f2120ce2c2f54d05592fa4e7831c5720b0e2729b 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/Distributor.java +++ b/src/main/java/teetime/stage/basic/distributor/Distributor.java @@ -14,10 +14,10 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.distributor; +package teetime.stage.basic.distributor; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/IDistributorStrategy.java b/src/main/java/teetime/stage/basic/distributor/IDistributorStrategy.java similarity index 87% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/IDistributorStrategy.java rename to src/main/java/teetime/stage/basic/distributor/IDistributorStrategy.java index fae7a25bfaaaf06e75a9b4308fdc01d548c9c481..69e537877b6b04181f527e6f59096d5557dd259b 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/IDistributorStrategy.java +++ b/src/main/java/teetime/stage/basic/distributor/IDistributorStrategy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.distributor; +package teetime.stage.basic.distributor; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.OutputPort; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/RoundRobinStrategy.java b/src/main/java/teetime/stage/basic/distributor/RoundRobinStrategy.java similarity index 90% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/RoundRobinStrategy.java rename to src/main/java/teetime/stage/basic/distributor/RoundRobinStrategy.java index e8b9279a6de87891250a18e4fd52794214f02376..64bf90f0fc8da79b3b2c0b999c35d6d7ace319be 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/distributor/RoundRobinStrategy.java +++ b/src/main/java/teetime/stage/basic/distributor/RoundRobinStrategy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.distributor; +package teetime.stage.basic.distributor; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.OutputPort; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/IMergerStrategy.java b/src/main/java/teetime/stage/basic/merger/IMergerStrategy.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/IMergerStrategy.java rename to src/main/java/teetime/stage/basic/merger/IMergerStrategy.java index 0975408352fff591830e7f6f2e28c0889bcab7a7..0114cf9b54bd1f614fb9de9bd99c7e136bd3859c 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/IMergerStrategy.java +++ b/src/main/java/teetime/stage/basic/merger/IMergerStrategy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.merger; +package teetime.stage.basic.merger; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/Merger.java b/src/main/java/teetime/stage/basic/merger/Merger.java similarity index 86% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/Merger.java rename to src/main/java/teetime/stage/basic/merger/Merger.java index d46369c9505542d72e3d1f822f8280e30fda35c7..eb4c9e315680ce85f94d81f09ab526cd517b1554 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/Merger.java +++ b/src/main/java/teetime/stage/basic/merger/Merger.java @@ -14,12 +14,12 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.merger; +package teetime.stage.basic.merger; -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.signal.ISignal; +import teetime.framework.AbstractStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.signal.ISignal; /** * diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/RoundRobinStrategy.java b/src/main/java/teetime/stage/basic/merger/RoundRobinStrategy.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/RoundRobinStrategy.java rename to src/main/java/teetime/stage/basic/merger/RoundRobinStrategy.java index bacfaa7a0d313fee0784e8663b28800634ed12de..3edb04787f01f3d2d26587def8638e13bb7aa265 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/basic/merger/RoundRobinStrategy.java +++ b/src/main/java/teetime/stage/basic/merger/RoundRobinStrategy.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.basic.merger; +package teetime.stage.basic.merger; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; +import teetime.framework.InputPort; /** * @author Nils Christian Ehmke diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/explorviz/KiekerRecordTcpReader.java b/src/main/java/teetime/stage/explorviz/KiekerRecordTcpReader.java similarity index 98% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/explorviz/KiekerRecordTcpReader.java rename to src/main/java/teetime/stage/explorviz/KiekerRecordTcpReader.java index ecbef3d56a2c59f024197bceeabcdcbc5936effa..cd0aa5162e8f70ae2987b029fd3aac244fe35dd6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/explorviz/KiekerRecordTcpReader.java +++ b/src/main/java/teetime/stage/explorviz/KiekerRecordTcpReader.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.stage.explorviz; +package teetime.stage.explorviz; import java.io.IOException; import java.net.InetSocketAddress; @@ -9,7 +9,7 @@ import java.nio.channels.SocketChannel; import java.util.ArrayList; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.trace.operation.AfterOperationEvent; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/DbReader.java b/src/main/java/teetime/stage/io/DbReader.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/DbReader.java rename to src/main/java/teetime/stage/io/DbReader.java index 497daeabeeab9b589d95e9c1a7e5edb0960a5d77..82ced4e9bb1b446df8f2eb03c12a142f56bcfd26 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/DbReader.java +++ b/src/main/java/teetime/stage/io/DbReader.java @@ -14,7 +14,7 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.sql.Connection; import java.sql.DriverManager; @@ -22,8 +22,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import teetime.variant.explicitScheduling.framework.core.Description; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; import kieker.common.exception.MonitoringRecordException; import kieker.common.record.AbstractMonitoringRecord; @@ -31,19 +30,27 @@ import kieker.common.record.IMonitoringRecord; /** * A very simple database reader that probably only works for small data sets. - * + * * @author Jan Waller, Nils Christian Ehmke - * + * * @since 1.10 */ -@Description("A reader which reads records from a database") +// @Description("A reader which reads records from a database") public class DbReader extends ProducerStage<IMonitoringRecord> { - @Description("The classname of the driver used for the connection.") + /** + * The classname of the driver used for the connection. + */ private String driverClassname = "org.apache.derby.jdbc.EmbeddedDrive"; - @Description("The connection string used to establish the connection.") + + /** + * The connection string used to establish the connection. + */ private String connectionString = "jdbc:derby:tmp/KIEKER;user=DBUSER;password=DBPASS"; - @Description("The prefix of the used table within the database.") + + /** + * The prefix of the used table within the database. + */ private String tablePrefix = "kieker"; private volatile boolean running = true; @@ -135,7 +142,7 @@ public class DbReader extends ProducerStage<IMonitoringRecord> { /** * This method uses the given table to read records and sends them to the output port. - * + * * @param connection * The connection to the database which will be used. * @param tablename diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/Directory2FilesFilter.java b/src/main/java/teetime/stage/io/Directory2FilesFilter.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/Directory2FilesFilter.java rename to src/main/java/teetime/stage/io/Directory2FilesFilter.java index 1107e60541a2529fe59ac2e14c60f0beb901e38b..cd45fc7bb84680d8494ee194de3cc1c34f503408 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/Directory2FilesFilter.java +++ b/src/main/java/teetime/stage/io/Directory2FilesFilter.java @@ -14,15 +14,15 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.io.File; import java.io.FileFilter; import java.util.Arrays; import java.util.Comparator; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/File2TextLinesFilter.java b/src/main/java/teetime/stage/io/File2TextLinesFilter.java similarity index 88% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/File2TextLinesFilter.java rename to src/main/java/teetime/stage/io/File2TextLinesFilter.java index 67fbc6a27b572c0f5a9103a2f0ae57e6fa5314e3..c4795559e3ca299ca49492702e76e2fc14a561a8 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/File2TextLinesFilter.java +++ b/src/main/java/teetime/stage/io/File2TextLinesFilter.java @@ -14,7 +14,7 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.io.BufferedReader; import java.io.File; @@ -23,13 +23,13 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import teetime.variant.explicitScheduling.stage.util.TextLine; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.stage.util.TextLine; /** * @author Christian Wulf - * + * * @since 1.10 */ public class File2TextLinesFilter extends ConsumerStage<File> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/IRecordFactoryMethod.java b/src/main/java/teetime/stage/io/IRecordFactoryMethod.java similarity index 81% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/IRecordFactoryMethod.java rename to src/main/java/teetime/stage/io/IRecordFactoryMethod.java index d1d997c29e5d822a902a2eb240e98726357c5d11..10849cd49654ddb762f835a01f4214419c659aa6 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/IRecordFactoryMethod.java +++ b/src/main/java/teetime/stage/io/IRecordFactoryMethod.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.nio.ByteBuffer; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/Printer.java b/src/main/java/teetime/stage/io/Printer.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/Printer.java rename to src/main/java/teetime/stage/io/Printer.java index 3bed4e2bcb487cd7fc3a76667a11bb290e92c503..40ee69ee69202d70a1d25d744e66b4e39d9b8843 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/Printer.java +++ b/src/main/java/teetime/stage/io/Printer.java @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; -import teetime.variant.explicitScheduling.framework.core.Description; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; +import teetime.framework.ConsumerStage; /** + * A filter to print objects to a configured stream + * * @author Matthias Rohr, Jan Waller, Nils Christian Ehmke * * @since 1.10 */ -@Description("A filter to print objects to a configured stream") public class Printer<T> extends ConsumerStage<T> { public static final String STREAM_STDOUT = "STDOUT"; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/RecordFactory.java b/src/main/java/teetime/stage/io/RecordFactory.java similarity index 95% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/RecordFactory.java rename to src/main/java/teetime/stage/io/RecordFactory.java index 9e46798fa2ecf532c3dbb5169fd1887f886ba509..0d012dbcf83cd872520eebc04259f082bbafdb19 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/RecordFactory.java +++ b/src/main/java/teetime/stage/io/RecordFactory.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.nio.ByteBuffer; import java.util.HashMap; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java b/src/main/java/teetime/stage/io/TCPReader.java similarity index 98% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java rename to src/main/java/teetime/stage/io/TCPReader.java index 3e09b86235c97e6db5959dda0c2b8670f51dbe7f..ee2d8d5b8f96b9fa009dbce20f623c1852e946a0 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/io/TCPReader.java +++ b/src/main/java/teetime/stage/io/TCPReader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.io; +package teetime.stage.io; import java.io.IOException; import java.net.InetSocketAddress; @@ -23,7 +23,7 @@ import java.nio.channels.ClosedByInterruptException; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; import kieker.common.exception.MonitoringRecordException; import kieker.common.logging.Log; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/Dir2RecordsFilter.java b/src/main/java/teetime/stage/kieker/Dir2RecordsFilter.java similarity index 77% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/Dir2RecordsFilter.java rename to src/main/java/teetime/stage/kieker/Dir2RecordsFilter.java index 689d326559e6fa6180ebd34d5d05b5657f9f04c0..eaf453f8e418c71c69d41a9497cb7b3eb9216cd9 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/Dir2RecordsFilter.java +++ b/src/main/java/teetime/stage/kieker/Dir2RecordsFilter.java @@ -13,25 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker; +package teetime.stage.kieker; import java.io.File; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.Pipeline; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.stage.FileExtensionSwitch; -import teetime.variant.methodcallWithPorts.stage.basic.merger.Merger; -import teetime.variant.methodcallWithPorts.stage.io.Directory2FilesFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.BinaryFile2RecordFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.DatFile2RecordFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.ZipFile2RecordFilter; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.Pipeline; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; +import teetime.stage.FileExtensionSwitch; +import teetime.stage.basic.merger.Merger; +import teetime.stage.io.Directory2FilesFilter; +import teetime.stage.kieker.className.ClassNameRegistryCreationFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.fileToRecord.BinaryFile2RecordFilter; +import teetime.stage.kieker.fileToRecord.DatFile2RecordFilter; +import teetime.stage.kieker.fileToRecord.ZipFile2RecordFilter; import kieker.common.record.IMonitoringRecord; import kieker.common.util.filesystem.BinaryCompressionMethod; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithBin2RecordFilter.java b/src/main/java/teetime/stage/kieker/DirWithBin2RecordFilter.java similarity index 69% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithBin2RecordFilter.java rename to src/main/java/teetime/stage/kieker/DirWithBin2RecordFilter.java index 86e015aa2b8c5dab5ce0c78dc3e8c81f5d4cbd16..37d672307e6683341fda7da2844976bd09a4df70 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithBin2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/DirWithBin2RecordFilter.java @@ -1,14 +1,14 @@ -package teetime.variant.methodcallWithPorts.stage.kieker; +package teetime.stage.kieker; import java.io.File; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.Pipeline; -import teetime.variant.methodcallWithPorts.stage.io.Directory2FilesFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.BinaryFile2RecordFilter; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.Pipeline; +import teetime.stage.io.Directory2FilesFilter; +import teetime.stage.kieker.className.ClassNameRegistryCreationFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.fileToRecord.BinaryFile2RecordFilter; import kieker.common.record.IMonitoringRecord; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithDat2RecordFilter.java b/src/main/java/teetime/stage/kieker/DirWithDat2RecordFilter.java similarity index 69% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithDat2RecordFilter.java rename to src/main/java/teetime/stage/kieker/DirWithDat2RecordFilter.java index d636a07df6e9ca2cbb54d2d0e8d4d0a91e314181..f663ba25d8886146f53f7f688042c64e3c454273 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/DirWithDat2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/DirWithDat2RecordFilter.java @@ -1,14 +1,14 @@ -package teetime.variant.methodcallWithPorts.stage.kieker; +package teetime.stage.kieker; import java.io.File; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.Pipeline; -import teetime.variant.methodcallWithPorts.stage.io.Directory2FilesFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.DatFile2RecordFilter; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.Pipeline; +import teetime.stage.io.Directory2FilesFilter; +import teetime.stage.kieker.className.ClassNameRegistryCreationFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.fileToRecord.DatFile2RecordFilter; import kieker.common.record.IMonitoringRecord; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/TCPReaderSink.java b/src/main/java/teetime/stage/kieker/TCPReaderSink.java similarity index 98% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/TCPReaderSink.java rename to src/main/java/teetime/stage/kieker/TCPReaderSink.java index 4bd7ef0a7cab4dad716f381d8123a76ac31e0d42..f61dbdd52b689e4493dcb7160c93e4b1b696854a 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/TCPReaderSink.java +++ b/src/main/java/teetime/stage/kieker/TCPReaderSink.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker; +package teetime.stage.kieker; import java.io.IOException; import java.net.InetSocketAddress; @@ -26,7 +26,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.ProducerStage; import kieker.common.exception.MonitoringRecordException; import kieker.common.logging.Log; diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistry.java b/src/main/java/teetime/stage/kieker/className/ClassNameRegistry.java similarity index 93% rename from src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistry.java rename to src/main/java/teetime/stage/kieker/className/ClassNameRegistry.java index 9a8f1656faadb58f8e5892fa8c146ac0bb7e6f19..15e300ede691b9ff5d9a1c33d8b6ba15f7cd1daa 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistry.java +++ b/src/main/java/teetime/stage/kieker/className/ClassNameRegistry.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.kieker.className; +package teetime.stage.kieker.className; import java.util.HashMap; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryCreationFilter.java b/src/main/java/teetime/stage/kieker/className/ClassNameRegistryCreationFilter.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryCreationFilter.java rename to src/main/java/teetime/stage/kieker/className/ClassNameRegistryCreationFilter.java index 1142c22bb266c2127f8555440a2ce3d55ce1df29..4171c34ac0a81ee87fab469bdc41e75ab05adc72 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryCreationFilter.java +++ b/src/main/java/teetime/stage/kieker/className/ClassNameRegistryCreationFilter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.className; +package teetime.stage.kieker.className; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryRepository.java b/src/main/java/teetime/stage/kieker/className/ClassNameRegistryRepository.java similarity index 96% rename from src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryRepository.java rename to src/main/java/teetime/stage/kieker/className/ClassNameRegistryRepository.java index fecda93ab01544e1344eac0e0ce1c678b190c20f..bbbd79117109f14dc6e59b2850a5f7a26cb9a3a1 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryRepository.java +++ b/src/main/java/teetime/stage/kieker/className/ClassNameRegistryRepository.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.kieker.className; +package teetime.stage.kieker.className; import java.io.File; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/MappingFileParser.java b/src/main/java/teetime/stage/kieker/className/MappingFileParser.java similarity index 98% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/MappingFileParser.java rename to src/main/java/teetime/stage/kieker/className/MappingFileParser.java index 107f7233da5bb49138f94fc874433fd3b13aa148..a428056aa49840f02f889a5bd9d8c74a5c64317e 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/MappingFileParser.java +++ b/src/main/java/teetime/stage/kieker/className/MappingFileParser.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.className; +package teetime.stage.kieker.className; import java.io.BufferedReader; import java.io.File; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java b/src/main/java/teetime/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java similarity index 91% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java rename to src/main/java/teetime/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java index 6e9769c6d621a5d76216ea54bd3adcd0e5137517..c25ebe898c1f1fabe752f4a0c1e07283356a32b8 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord; +package teetime.stage.kieker.fileToRecord; import java.io.DataInputStream; import java.io.File; import java.io.IOException; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.stage.kieker.className.ClassNameRegistryRepository; import kieker.common.exception.MonitoringRecordException; import kieker.common.record.IMonitoringRecord; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/DatFile2RecordFilter.java b/src/main/java/teetime/stage/kieker/fileToRecord/DatFile2RecordFilter.java similarity index 73% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/DatFile2RecordFilter.java rename to src/main/java/teetime/stage/kieker/fileToRecord/DatFile2RecordFilter.java index 704ceffa8804a32b570a066e44a6453afb074bb2..8058dacc2c7acc1584687fd17938471a1f6e3cf2 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/DatFile2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/DatFile2RecordFilter.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord; +package teetime.stage.kieker.fileToRecord; import java.io.File; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.Pipeline; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.stage.io.File2TextLinesFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.Pipeline; +import teetime.framework.pipe.SingleElementPipe; +import teetime.stage.io.File2TextLinesFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; import kieker.common.record.IMonitoringRecord; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java b/src/main/java/teetime/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java similarity index 94% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java rename to src/main/java/teetime/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java index ad01b5d4b0f149a8050ae4a82ba108d80d0cda10..17700c2a93973eb11c4a519e76711fa62ded3667 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord; +package teetime.stage.kieker.fileToRecord; import java.io.DataInputStream; import java.io.EOFException; @@ -22,8 +22,8 @@ import java.io.IOException; import org.slf4j.Logger; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistry; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.className.ClassNameRegistry; +import teetime.stage.kieker.className.ClassNameRegistryRepository; import kieker.common.exception.MonitoringRecordException; import kieker.common.record.AbstractMonitoringRecord; diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromTextLineCreator.java b/src/main/java/teetime/stage/kieker/fileToRecord/RecordFromTextLineCreator.java similarity index 93% rename from src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromTextLineCreator.java rename to src/main/java/teetime/stage/kieker/fileToRecord/RecordFromTextLineCreator.java index cffcb48efffcd28678e487c1b428c7cd07230ebd..118fec7521f3645ebf0650dd6fce7d2d09de2e10 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromTextLineCreator.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/RecordFromTextLineCreator.java @@ -13,10 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.kieker.fileToRecord; +package teetime.stage.kieker.fileToRecord; import java.io.File; +import teetime.stage.kieker.className.ClassNameRegistry; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.util.MappingException; + import kieker.common.exception.IllegalRecordFormatException; import kieker.common.exception.MonitoringRecordException; import kieker.common.exception.UnknownRecordTypeException; @@ -24,10 +28,6 @@ import kieker.common.record.AbstractMonitoringRecord; import kieker.common.record.IMonitoringRecord; import kieker.common.record.controlflow.OperationExecutionRecord; -import teetime.variant.explicitScheduling.stage.MappingException; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistry; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; - /** * @author Christian Wulf * diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/ZipFile2RecordFilter.java b/src/main/java/teetime/stage/kieker/fileToRecord/ZipFile2RecordFilter.java similarity index 91% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/ZipFile2RecordFilter.java rename to src/main/java/teetime/stage/kieker/fileToRecord/ZipFile2RecordFilter.java index a1ecb038b33bdbaa573899746c7af0e34b0f4988..e9686124d16453603ca5e6984c25098ae810774a 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/ZipFile2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/ZipFile2RecordFilter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord; +package teetime.stage.kieker.fileToRecord; import java.io.BufferedInputStream; import java.io.BufferedReader; @@ -28,10 +28,10 @@ import java.io.UnsupportedEncodingException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistry; -import teetime.variant.methodcallWithPorts.stage.kieker.className.MappingFileParser; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.stage.kieker.className.ClassNameRegistry; +import teetime.stage.kieker.className.MappingFileParser; import kieker.common.record.IMonitoringRecord; import kieker.common.util.filesystem.FSUtil; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java b/src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java rename to src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java index 68f2cc72902d1f6c5db5a7823a1f7316f5bb8582..e15f352f7d121bb8f174efa80413c9c4c9776fe1 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java @@ -14,11 +14,11 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.textLine; +package teetime.stage.kieker.fileToRecord.textLine; import java.util.Map; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; +import teetime.framework.ConsumerStage; import kieker.common.util.filesystem.FSUtil; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java b/src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java similarity index 86% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java rename to src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java index 6bc76669e79091803213242c0f851a9b8419617f..b730d2d5bc8cd289fa53ebc0df290721e2fbe591 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java +++ b/src/main/java/teetime/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java @@ -14,17 +14,17 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.textLine; +package teetime.stage.kieker.fileToRecord.textLine; import java.util.HashSet; import java.util.Set; -import teetime.variant.explicitScheduling.stage.MappingException; -import teetime.variant.explicitScheduling.stage.util.TextLine; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord.RecordFromTextLineCreator; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.fileToRecord.RecordFromTextLineCreator; +import teetime.stage.util.MappingException; +import teetime.stage.util.TextLine; import kieker.common.exception.IllegalRecordFormatException; import kieker.common.exception.MonitoringRecordException; @@ -33,7 +33,7 @@ import kieker.common.record.IMonitoringRecord; /** * @author Christian Wulf - * + * * @since 1.10 */ public class TextLine2RecordFilter extends ConsumerStage<TextLine> { diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReconstruction/TraceReconstructionFilter.java b/src/main/java/teetime/stage/kieker/traceReconstruction/TraceReconstructionFilter.java similarity index 95% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReconstruction/TraceReconstructionFilter.java rename to src/main/java/teetime/stage/kieker/traceReconstruction/TraceReconstructionFilter.java index 4693eea8765030544096d89d1b192cfb569c52cc..9453af863ff0a7a74ac995464920e401d6088356 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReconstruction/TraceReconstructionFilter.java +++ b/src/main/java/teetime/stage/kieker/traceReconstruction/TraceReconstructionFilter.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction; +package teetime.stage.kieker.traceReconstruction; import java.util.concurrent.TimeUnit; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.flow.IFlowRecord; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceAggregationBuffer.java b/src/main/java/teetime/stage/kieker/traceReduction/TraceAggregationBuffer.java similarity index 92% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceAggregationBuffer.java rename to src/main/java/teetime/stage/kieker/traceReduction/TraceAggregationBuffer.java index 80dca6106d60069137cc27e314daa8131f405e7c..56b1c257953d1f1ab940b060e73c0719a0ace656 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceAggregationBuffer.java +++ b/src/main/java/teetime/stage/kieker/traceReduction/TraceAggregationBuffer.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.stage.kieker.traceReduction; +package teetime.stage.kieker.traceReduction; import kieker.analysis.plugin.filter.flow.TraceEventRecords; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceComperator.java b/src/main/java/teetime/stage/kieker/traceReduction/TraceComperator.java similarity index 96% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceComperator.java rename to src/main/java/teetime/stage/kieker/traceReduction/TraceComperator.java index d1a5b770fd75df3ae469ec70afd314727566963b..b1fadaeb1faee62b27261ed50da76cc5da4137a0 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceComperator.java +++ b/src/main/java/teetime/stage/kieker/traceReduction/TraceComperator.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.stage.kieker.traceReduction; +package teetime.stage.kieker.traceReduction; import java.io.Serializable; import java.util.Comparator; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java b/src/main/java/teetime/stage/kieker/traceReduction/TraceReductionFilter.java similarity index 93% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java rename to src/main/java/teetime/stage/kieker/traceReduction/TraceReductionFilter.java index 6c3baa217e8897cb02981f0d49e6b140c2bc4f22..0a66326b105fbf19c0bc00c141fcc17a898f4240 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/traceReduction/TraceReductionFilter.java +++ b/src/main/java/teetime/stage/kieker/traceReduction/TraceReductionFilter.java @@ -14,15 +14,15 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.kieker.traceReduction; +package teetime.stage.kieker.traceReduction; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; +import teetime.framework.ConsumerStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; import kieker.analysis.plugin.filter.flow.TraceEventRecords; diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/StringBufferFilter.java b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java similarity index 86% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/StringBufferFilter.java rename to src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java index a566f7a5d3401cb706ec6752862e585d81f599c2..2cefc39dd013fb00c160ef34adb223a0439b8b97 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/StringBufferFilter.java +++ b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.stringBuffer; +package teetime.stage.stringBuffer; import java.util.Collection; import java.util.LinkedList; -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.handler.AbstractDataTypeHandler; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.util.KiekerHashMap; +import teetime.framework.ConsumerStage; +import teetime.framework.OutputPort; +import teetime.stage.stringBuffer.handler.AbstractDataTypeHandler; +import teetime.stage.stringBuffer.util.KiekerHashMap; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/AbstractDataTypeHandler.java b/src/main/java/teetime/stage/stringBuffer/handler/AbstractDataTypeHandler.java similarity index 89% rename from src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/AbstractDataTypeHandler.java rename to src/main/java/teetime/stage/stringBuffer/handler/AbstractDataTypeHandler.java index 353662eee3993f1dd84ffb2596565784249c81cd..f58688df027c7ab160fabf1a55ddb1f708e161b0 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/AbstractDataTypeHandler.java +++ b/src/main/java/teetime/stage/stringBuffer/handler/AbstractDataTypeHandler.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.stage.stringBuffer.handler; +package teetime.stage.stringBuffer.handler; import org.slf4j.Logger; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.util.KiekerHashMap; +import teetime.stage.stringBuffer.util.KiekerHashMap; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/IMonitoringRecordHandler.java b/src/main/java/teetime/stage/stringBuffer/handler/IMonitoringRecordHandler.java similarity index 96% rename from src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/IMonitoringRecordHandler.java rename to src/main/java/teetime/stage/stringBuffer/handler/IMonitoringRecordHandler.java index 6d6f4e5cdfcc42584f959d30dd9f6356ef535bc4..ee345747f9ab70a1ec5e9f8ce26524fec8dd2e4d 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/IMonitoringRecordHandler.java +++ b/src/main/java/teetime/stage/stringBuffer/handler/IMonitoringRecordHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.stringBuffer.handler; +package teetime.stage.stringBuffer.handler; import kieker.common.exception.MonitoringRecordException; import kieker.common.record.AbstractMonitoringRecord; diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/StringHandler.java b/src/main/java/teetime/stage/stringBuffer/handler/StringHandler.java similarity index 93% rename from src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/StringHandler.java rename to src/main/java/teetime/stage/stringBuffer/handler/StringHandler.java index eac8f68aecc39d8ae57699fd23e0761499160728..82c356faf7727ec9d4b1521a9aceb8594837afca 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/StringHandler.java +++ b/src/main/java/teetime/stage/stringBuffer/handler/StringHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.stringBuffer.handler; +package teetime.stage.stringBuffer.handler; /** * @author Christian Wulf diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/util/KiekerHashMap.java b/src/main/java/teetime/stage/stringBuffer/util/KiekerHashMap.java similarity index 99% rename from src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/util/KiekerHashMap.java rename to src/main/java/teetime/stage/stringBuffer/util/KiekerHashMap.java index 0121ad50a0994be40f1840242634ae116a14cb61..22542a58e94def8f0df6da4500332b422c550d55 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/util/KiekerHashMap.java +++ b/src/main/java/teetime/stage/stringBuffer/util/KiekerHashMap.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.stringBuffer.util; +package teetime.stage.stringBuffer.util; import java.lang.ref.SoftReference; import java.util.concurrent.locks.ReentrantLock; diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/MappingException.java b/src/main/java/teetime/stage/util/MappingException.java similarity index 94% rename from src/main/java/teetime/variant/explicitScheduling/stage/MappingException.java rename to src/main/java/teetime/stage/util/MappingException.java index a718972aa5ed1c1db024ee77b0ceed899fb56f5c..40a83811c337bcbfbe56b9437bd7bfbbad790999 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/MappingException.java +++ b/src/main/java/teetime/stage/util/MappingException.java @@ -14,11 +14,11 @@ * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage; +package teetime.stage.util; /** * @author Christian Wulf - * + * * @since 1.10 */ public class MappingException extends Exception { diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/util/TextLine.java b/src/main/java/teetime/stage/util/TextLine.java similarity index 95% rename from src/main/java/teetime/variant/explicitScheduling/stage/util/TextLine.java rename to src/main/java/teetime/stage/util/TextLine.java index 016463d95f50628fded1381039e9814320370c9f..deb5ed8ab60c1aadf3bc2d93c112d57260e5dc02 100644 --- a/src/main/java/teetime/variant/explicitScheduling/stage/util/TextLine.java +++ b/src/main/java/teetime/stage/util/TextLine.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.stage.util; +package teetime.stage.util; import java.io.File; /** * @author Christian Wulf - * + * * @since 1.10 */ public class TextLine { diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/TimestampObject.java b/src/main/java/teetime/util/TimestampObject.java similarity index 95% rename from src/main/java/teetime/variant/explicitScheduling/examples/throughput/TimestampObject.java rename to src/main/java/teetime/util/TimestampObject.java index 6e875bd9541ec86a9a65b811101a02bbf500f0ed..d47cf229329cdcaf16cf86644ac066436a86da83 100644 --- a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/TimestampObject.java +++ b/src/main/java/teetime/util/TimestampObject.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.explicitScheduling.examples.throughput; +package teetime.util; /** * Object for performance evaluation - * + * * @author Christian Wulf - * + * * @since 1.10 */ public final class TimestampObject { diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/ConcurrentCountWordsAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/ConcurrentCountWordsAnalysis.java deleted file mode 100644 index 5ebe8aff7d5e6f2651d73adcb7c165705ed310ea..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/ConcurrentCountWordsAnalysis.java +++ /dev/null @@ -1,292 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.Pair; -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipeFactory; -import teetime.variant.explicitScheduling.framework.concurrent.SingleProducerSingleConsumerPipe; -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.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.Pipeline; -import teetime.variant.explicitScheduling.framework.core.IInputPort.PortState; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.framework.sequential.QueuePipe; -import teetime.variant.explicitScheduling.stage.basic.RepeaterSource; -import teetime.variant.explicitScheduling.stage.basic.distributor.Distributor; -import teetime.variant.explicitScheduling.stage.basic.merger.Merger; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ConcurrentCountWordsAnalysis extends Analysis { - - private static final int NUM_TOKENS_TO_REPEAT = 1000; - private static final String START_DIRECTORY_NAME = "."; - private static final int SECONDS = 1000; - - private static final int MAX_NUM_THREADS = 2; // 1:2150, 2:1400, 3:~1400, 4:~1400 - - private WorkerThread[] ioThreads; - private WorkerThread[] nonIoThreads; - - ConcurrentWorkStealingPipeFactory<?>[] pipeFactories; - - @Override - public void init() { - super.init(); - - this.ioThreads = new WorkerThread[2]; - - final IPipeline readerThreadPipeline = this.readerThreadPipeline(); - @SuppressWarnings("unchecked") - final Distributor<File> distributor = (Distributor<File>) readerThreadPipeline.getStages().get(readerThreadPipeline.getStages().size() - 1); - this.ioThreads[0] = new WorkerThread(readerThreadPipeline, 1); - this.ioThreads[0].setName("startThread"); - this.ioThreads[0].setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - final IPipeline printingThreadPipeline = this.printingThreadPipeline(); - @SuppressWarnings("unchecked") - final Merger<Pair<File, Integer>> merger = (Merger<Pair<File, Integer>>) printingThreadPipeline.getStages().get(0); - this.ioThreads[1] = new WorkerThread(printingThreadPipeline, 2); - this.ioThreads[1].setName("printingThread"); - this.ioThreads[1].setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - this.createPipeFactories(); - - int numThreads = Runtime.getRuntime().availableProcessors(); - numThreads = Math.min(MAX_NUM_THREADS, numThreads); // only for testing purposes - System.out.println("Using " + numThreads + " Threads."); - - this.nonIoThreads = new WorkerThread[numThreads]; - for (int i = 0; i < this.nonIoThreads.length; i++) { - final IPipeline pipeline = this.buildNonIoPipeline(distributor, merger); - this.nonIoThreads[i] = new WorkerThread(pipeline, 0); - this.nonIoThreads[i].setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - } - } - - @Override - public void start() { - super.start(); - - for (final WorkerThread thread : this.ioThreads) { - thread.start(); - } - - for (final WorkerThread thread : this.nonIoThreads) { - thread.start(); - } - - System.out.println("Waiting for the non I/O worker threads to terminate..."); // NOPMD (Just for example purposes) - for (final WorkerThread thread : this.nonIoThreads) { - try { - thread.join(60 * SECONDS); - } catch (final InterruptedException e) { - throw new IllegalStateException(); - } - } - - System.out.println("Waiting for the I/O worker threads to terminate..."); // NOPMD (Just for example purposes) - for (final WorkerThread thread : this.ioThreads) { - try { - thread.join(60 * SECONDS); - } catch (final InterruptedException e) { - throw new IllegalStateException(); - } - } - - System.out.println("Analysis finished."); // NOPMD (Just for example purposes) - } - - private void createPipeFactories() { - this.pipeFactories = new ConcurrentWorkStealingPipeFactory[4]; - this.pipeFactories[0] = new ConcurrentWorkStealingPipeFactory<File>(); - this.pipeFactories[1] = new ConcurrentWorkStealingPipeFactory<File>(); - this.pipeFactories[2] = new ConcurrentWorkStealingPipeFactory<Pair<File, Integer>>(); - this.pipeFactories[3] = new ConcurrentWorkStealingPipeFactory<Pair<File, Integer>>(); - } - - private IPipeline readerThreadPipeline() { - // create stages - final RepeaterSource<String> repeaterSource = RepeaterSource.create(START_DIRECTORY_NAME, NUM_TOKENS_TO_REPEAT); - repeaterSource.setAccessesDeviceId(1); - final DirectoryName2Files directoryName2Files = new DirectoryName2Files(); - directoryName2Files.setAccessesDeviceId(1); - final Distributor<File> distributor = new Distributor<File>(); - distributor.setAccessesDeviceId(1); - - // add each stage to a stage list - final List<IStage> startStages = new LinkedList<IStage>(); - startStages.add(repeaterSource); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(repeaterSource); - stages.add(directoryName2Files); - stages.add(distributor); - - // connect stages by pipes - QueuePipe.connect(repeaterSource.OUTPUT, directoryName2Files.DIRECTORY_NAME); - QueuePipe.connect(directoryName2Files.fileOutputPort, distributor.genericInputPort); - - repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); - repeaterSource.START.setState(PortState.CLOSED); - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - private IPipeline buildNonIoPipeline(final Distributor<File> readerDistributor, final Merger<Pair<File, Integer>> printingMerger) { - // create stages - final Distributor<File> distributor = new Distributor<File>(); - final CountWordsStage countWordsStage0 = new CountWordsStage(); - final CountWordsStage countWordsStage1 = new CountWordsStage(); - final Merger<Pair<File, Integer>> merger = new Merger<Pair<File, Integer>>(); - - // add each stage to a stage list - final List<IStage> startStages = new LinkedList<IStage>(); - startStages.add(distributor); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(distributor); - stages.add(countWordsStage0); - stages.add(countWordsStage1); - stages.add(merger); - - // connect stages by pipes - SingleProducerSingleConsumerPipe.connect(readerDistributor.getNewOutputPort(), distributor.genericInputPort); - - this.connectWithStealAwarePipe(this.pipeFactories[0], distributor.getNewOutputPort(), countWordsStage0.FILE); - this.connectWithStealAwarePipe(this.pipeFactories[1], distributor.getNewOutputPort(), countWordsStage1.FILE); - this.connectWithStealAwarePipe(this.pipeFactories[2], countWordsStage0.WORDSCOUNT, merger.getNewInputPort()); - this.connectWithStealAwarePipe(this.pipeFactories[3], countWordsStage1.WORDSCOUNT, merger.getNewInputPort()); - - SingleProducerSingleConsumerPipe.connect(merger.outputPort, printingMerger.getNewInputPort()); - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - private IPipeline printingThreadPipeline() { - // create stages - final Merger<Pair<File, Integer>> merger = new Merger<Pair<File, Integer>>(); - merger.setAccessesDeviceId(2); - final OutputWordsCountSink outputWordsCountStage = new OutputWordsCountSink(); - outputWordsCountStage.setAccessesDeviceId(2); - - // add each stage to a stage list - final List<IStage> startStages = new LinkedList<IStage>(); - startStages.add(merger); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(merger); - stages.add(outputWordsCountStage); - - // connect stages by pipes - QueuePipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - private <A extends ISource, B extends ISink<B>, T> void connectWithStealAwarePipe(final ConcurrentWorkStealingPipeFactory<?> pipeFactory, - final IOutputPort<A, T> sourcePort, final IInputPort<B, T> targetPort) { - @SuppressWarnings("unchecked") - final ConcurrentWorkStealingPipe<T> pipe = (ConcurrentWorkStealingPipe<T>) pipeFactory.create(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - /** - * @since 1.10 - */ - public static void main(final String[] args) { - final ConcurrentCountWordsAnalysis analysis = new ConcurrentCountWordsAnalysis(); - analysis.init(); - final long start = System.currentTimeMillis(); - analysis.start(); - final long end = System.currentTimeMillis(); - // analysis.terminate(); - final long duration = end - start; - System.out.println("duration: " + duration + " ms"); // NOPMD (Just for example purposes) - - analysis.analyzeThreads(); - } - - private void analyzeThreads() { - long maxDuration = -1; - WorkerThread maxThread = null; - - // FIXME resolve bug; see analysis results below; - // - // --- Thread[startThread,5,] --- - // {RepeaterSource: numPushedElements={numPushedElements=1000, numTakenElements=1}} - // {DirectoryName2Files: numPushedElements={numPushedElements=16000, numTakenElements=1000}} - // {Distributor: numPushedElements={numPushedElements=16000, numTakenElements=16000}} - // --- Thread[Thread-2,5,] --- - // {Distributor: numPushedElements={numPushedElements=16008, numTakenElements=16008}} - // - // cause: the non-io distributor is executed faster than the io distributor - - for (final WorkerThread thread : this.ioThreads) { - System.out.println("--- " + thread + " ---"); // NOPMD (Just for example purposes) - for (final IStage stage : thread.getPipeline().getStages()) { - System.out.println(stage); // NOPMD (Just for example purposes) - } - - // final long durationInNs = thread.getDurationInNs(); - // System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); - } - - for (final WorkerThread thread : this.nonIoThreads) { - System.out.println("--- " + thread + " ---"); // NOPMD (Just for example purposes) - for (final IStage stage : thread.getPipeline().getStages()) { - System.out.println(stage); // NOPMD (Just for example purposes) - } - - // final long durationInNs = thread.getDurationInNs(); - // System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); - - // if (durationInNs > maxDuration) { - // maxDuration = durationInNs; - // maxThread = thread; - // } - } - - // System.out.println("maxThread: " + maxThread.toString() + " takes " + TimeUnit.NANOSECONDS.toMillis(maxDuration) + " ms"); // NOPMD (Just for example - // purposes) - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsAnalysis.java deleted file mode 100644 index feba3ab0419dfcd64cba613fd1677d678977265c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsAnalysis.java +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.Pair; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.Pipeline; -import teetime.variant.explicitScheduling.framework.core.IInputPort.PortState; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.stage.basic.RepeaterSource; -import teetime.variant.explicitScheduling.stage.basic.distributor.Distributor; -import teetime.variant.explicitScheduling.stage.basic.merger.Merger; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CountWordsAnalysis extends Analysis { - - private static final int NUM_TOKENS_TO_REPEAT = 1000; - private static final String START_DIRECTORY_NAME = "."; - - private IPipeline pipeline; - - @Override - public void init() { - super.init(); - - this.pipeline = this.buildNonIoPipeline(); - } - - @Override - public void start() { - super.start(); - try { - this.pipeline.fireStartNotification(); - } catch (final Exception e) { - e.printStackTrace(); - } - - this.pipeline.getStartStages().get(0).execute(); - - try { - this.pipeline.fireStopNotification(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - - private IPipeline buildNonIoPipeline() { - // create stages - final RepeaterSource<String> repeaterSource = RepeaterSource.create(START_DIRECTORY_NAME, NUM_TOKENS_TO_REPEAT); - final DirectoryName2Files findFilesStage = new DirectoryName2Files(); - final Distributor<File> distributor = new Distributor<File>(); - final CountWordsStage countWordsStage0 = new CountWordsStage(); - final CountWordsStage countWordsStage1 = new CountWordsStage(); - final Merger<Pair<File, Integer>> merger = new Merger<Pair<File, Integer>>(); - final OutputWordsCountSink outputWordsCountStage = new OutputWordsCountSink(); - - // add each stage to a stage list - final List<IStage> startStages = new LinkedList<IStage>(); - startStages.add(repeaterSource); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(repeaterSource); - stages.add(findFilesStage); - stages.add(distributor); - stages.add(countWordsStage0); - stages.add(countWordsStage1); - stages.add(merger); - stages.add(outputWordsCountStage); - - // connect stages by pipes - MethodCallPipe.connect(repeaterSource.OUTPUT, findFilesStage.DIRECTORY_NAME); - MethodCallPipe.connect(findFilesStage.fileOutputPort, distributor.genericInputPort); - MethodCallPipe.connect(distributor.getNewOutputPort(), countWordsStage0.FILE); - MethodCallPipe.connect(distributor.getNewOutputPort(), countWordsStage1.FILE); - MethodCallPipe.connect(countWordsStage0.WORDSCOUNT, merger.getNewInputPort()); - MethodCallPipe.connect(countWordsStage1.WORDSCOUNT, merger.getNewInputPort()); - MethodCallPipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); - - repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); - repeaterSource.START.setState(PortState.CLOSED); - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - public static void main(final String[] args) { - final CountWordsAnalysis analysis = new CountWordsAnalysis(); - analysis.init(); - final long start = System.currentTimeMillis(); - analysis.start(); - final long end = System.currentTimeMillis(); - // analysis.terminate(); - final long duration = end - start; - System.out.println("duration: " + duration + " ms"); // NOPMD (Just for example purposes) - - for (final IStage stage : analysis.pipeline.getStages()) { - if (stage instanceof AbstractFilter<?>) { -// System.out.println(stage.getClass().getName() + ": " + ((AbstractFilter<?>) stage).getOverallDurationInNs()); // NOPMD (Just for example purposes) - } - } - - final DirectoryName2Files findFilesStage = (DirectoryName2Files) analysis.pipeline.getStages().get(1); - System.out.println("findFilesStage: " + findFilesStage.getNumFiles()); // NOPMD (Just for example purposes) - - final OutputWordsCountSink outputWordsCountStage = (OutputWordsCountSink) analysis.pipeline.getStages().get(6); - System.out.println("outputWordsCountStage: " + outputWordsCountStage.getNumFiles()); // NOPMD (Just for example purposes) - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsStage.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsStage.java deleted file mode 100644 index 33e8f9c28ebe685781b3f08059a779356e3c0263..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/CountWordsStage.java +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.regex.Pattern; - -import teetime.util.Pair; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CountWordsStage extends AbstractFilter<CountWordsStage> { - - public final IInputPort<CountWordsStage, File> FILE = this.createInputPort(); - - public final IOutputPort<CountWordsStage, Exception> EXCEPTION = this.createOutputPort(); - public final IOutputPort<CountWordsStage, Pair<File, Integer>> WORDSCOUNT = this.createOutputPort(); - - private final Pattern pattern = Pattern.compile("[^\\p{Graph}]"); - - @Override - protected boolean execute(final Context<CountWordsStage> context) { - final File file = context.tryTake(this.FILE); - if (file == null) { - return false; - } - - int wordsCount = 0; - try { - final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8")); - try { - String line; - while ((line = reader.readLine()) != null) { - line = line.trim(); - if (line.length() > 0) { - final String[] words = this.pattern.split(line); - // System.out.println("" + Arrays.toString(words)); - wordsCount += words.length; - } - } - } finally { - reader.close(); - } - context.put(this.WORDSCOUNT, Pair.of(file, wordsCount)); - } catch (final FileNotFoundException e) { - context.put(this.EXCEPTION, e); - } catch (final IOException e) { - context.put(this.EXCEPTION, e); - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/DirectoryName2Files.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/DirectoryName2Files.java deleted file mode 100644 index 54f422be913072e6c340362934d4360e451af231..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/DirectoryName2Files.java +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.File; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class DirectoryName2Files extends AbstractFilter<DirectoryName2Files> { - - public final IInputPort<DirectoryName2Files, String> DIRECTORY_NAME = this.createInputPort(); - - public final IOutputPort<DirectoryName2Files, File> fileOutputPort = this.createOutputPort(); - - private int numFiles = 0; - - public DirectoryName2Files() { - // this.setAccessesDeviceId(1); - } - - @Override - protected boolean execute(final Context<DirectoryName2Files> context) { - final String inputDir = context.tryTake(this.DIRECTORY_NAME); - if (inputDir == null) { - return false; - } - - final File[] availableFiles = new File(inputDir).listFiles(); - for (final File file : availableFiles) { - if (file.isFile()) { - // this.logger.info("Sending " + file); - context.put(this.fileOutputPort, file); - this.numFiles++; - } - } - - return true; - } - - public int getNumFiles() { - return this.numFiles; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/OutputWordsCountSink.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/OutputWordsCountSink.java deleted file mode 100644 index 8ac5dfe528480d2b3a214bf24472eff1ad1bcc07..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/OutputWordsCountSink.java +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.File; - -import teetime.util.Pair; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class OutputWordsCountSink extends AbstractFilter<OutputWordsCountSink> { - - public final IInputPort<OutputWordsCountSink, Pair<File, Integer>> fileWordcountTupleInputPort = this.createInputPort(); - - private int numFiles = 0; - - public OutputWordsCountSink() { - // this.setAccessesDeviceId(2); - } - - @Override - protected boolean execute(final Context<OutputWordsCountSink> context) { - final Pair<File, Integer> pair = context.tryTake(this.fileWordcountTupleInputPort); - if (pair == null) { - return false; - } - - // final File file = pair.getFirst(); - // final Number wordsCount = pair.getSecond(); - // System.out.println(wordsCount + " words in file '" + file.getAbsolutePath() + "'"); // NOPMD (Just for example purposes) - this.numFiles++; - - return true; - } - - /** - * @since 1.10 - * @return - */ - public int getNumFiles() { - return this.numFiles; - } - - @Override - public String toString() { - return super.toString() + ", numFiles = " + this.numFiles; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/QueuedCountWordsAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/countWords/QueuedCountWordsAnalysis.java deleted file mode 100644 index e77ac45fa005427665525078df7cb0a16b3e2b9b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countWords/QueuedCountWordsAnalysis.java +++ /dev/null @@ -1,143 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countWords; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.Pair; -import teetime.variant.explicitScheduling.framework.concurrent.StageTerminationPolicy; -import teetime.variant.explicitScheduling.framework.concurrent.WorkerThread; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.Pipeline; -import teetime.variant.explicitScheduling.framework.core.IInputPort.PortState; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.framework.sequential.QueuePipe; -import teetime.variant.explicitScheduling.stage.basic.RepeaterSource; -import teetime.variant.explicitScheduling.stage.basic.distributor.Distributor; -import teetime.variant.explicitScheduling.stage.basic.merger.Merger; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class QueuedCountWordsAnalysis extends Analysis { - - private static final int NUM_TOKENS_TO_REPEAT = 1000; - private static final String START_DIRECTORY_NAME = "."; - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - @Override - public void init() { - super.init(); - - final IPipeline pipeline = this.buildNonIoPipeline(); - - this.workerThread = new WorkerThread(pipeline, 0); - } - - @Override - public void start() { - super.start(); - - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } - - private IPipeline buildNonIoPipeline() { - // create stages - final RepeaterSource<String> repeaterSource = RepeaterSource.create(START_DIRECTORY_NAME, NUM_TOKENS_TO_REPEAT); - final DirectoryName2Files findFilesStage = new DirectoryName2Files(); - final Distributor<File> distributor = new Distributor<File>(); - final CountWordsStage countWordsStage0 = new CountWordsStage(); - final CountWordsStage countWordsStage1 = new CountWordsStage(); - final Merger<Pair<File, Integer>> merger = new Merger<Pair<File, Integer>>(); - final OutputWordsCountSink outputWordsCountStage = new OutputWordsCountSink(); - - // add each stage to a stage list - final List<IStage> startStages = new LinkedList<IStage>(); - startStages.add(repeaterSource); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(repeaterSource); - stages.add(findFilesStage); - stages.add(distributor); - stages.add(countWordsStage0); - stages.add(countWordsStage1); - stages.add(merger); - stages.add(outputWordsCountStage); - - // connect stages by pipes - QueuePipe.connect(repeaterSource.OUTPUT, findFilesStage.DIRECTORY_NAME); - QueuePipe.connect(findFilesStage.fileOutputPort, distributor.genericInputPort); - QueuePipe.connect(distributor.getNewOutputPort(), countWordsStage0.FILE); - QueuePipe.connect(distributor.getNewOutputPort(), countWordsStage1.FILE); - QueuePipe.connect(countWordsStage0.WORDSCOUNT, merger.getNewInputPort()); - QueuePipe.connect(countWordsStage1.WORDSCOUNT, merger.getNewInputPort()); - QueuePipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); - - repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); - repeaterSource.START.setState(PortState.CLOSED); - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - WorkerThread getWorkerThread() { - return this.workerThread; - } - - public static void main(final String[] args) { - final QueuedCountWordsAnalysis analysis = new QueuedCountWordsAnalysis(); - analysis.init(); - final long start = System.currentTimeMillis(); - analysis.start(); - final long end = System.currentTimeMillis(); - // analysis.terminate(); - final long duration = end - start; - System.out.println("duration: " + duration + " ms"); // NOPMD (Just for example purposes) - - final IPipeline pipeline = analysis.workerThread.getPipeline(); - - for (final IStage stage : pipeline.getStages()) { - if (stage instanceof AbstractFilter<?>) { - // System.out.println(stage.getClass().getName() + ": " + ((AbstractFilter<?>) stage).getOverallDurationInNs()); // NOPMD (Just for example purposes) - } - } - - final DirectoryName2Files findFilesStage = (DirectoryName2Files) pipeline.getStages().get(1); - System.out.println("findFilesStage: " + findFilesStage.getNumFiles()); // NOPMD (Just for example purposes) - - final OutputWordsCountSink outputWordsCountStage = (OutputWordsCountSink) pipeline.getStages().get(6); - System.out.println("outputWordsCountStage: " + outputWordsCountStage.getNumFiles()); // NOPMD (Just for example purposes) - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/countingObjects/CountingObjectsAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/countingObjects/CountingObjectsAnalysis.java deleted file mode 100644 index 4e91a737a3e1dad476dfb1b9482bbeaea760c1ca..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/countingObjects/CountingObjectsAnalysis.java +++ /dev/null @@ -1,142 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.countingObjects; - -import java.io.File; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import teetime.variant.explicitScheduling.examples.countWords.DirectoryName2Files; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.stage.TypeLoggerFilter; -import teetime.variant.explicitScheduling.stage.basic.RepeaterSource; -import teetime.variant.explicitScheduling.stage.composite.CycledCountingFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CountingObjectsAnalysis extends Analysis { - - private IPipeline pipeline; - - @Override - public void init() { - super.init(); - - this.pipeline = this.buildNonIoPipeline(); - } - - private IPipeline buildNonIoPipeline() { - // create stages - final RepeaterSource<String> repeaterSource = RepeaterSource.create(".", 1); - final DirectoryName2Files findFilesStage = new DirectoryName2Files(); - final CycledCountingFilter<File> cycledCountingFilter = CycledCountingFilter.create(new MethodCallPipe<Long>(0L)); - final TypeLoggerFilter<File> typeLoggerFilter = TypeLoggerFilter.create(); - - // add each stage to a stage list - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(repeaterSource); - stages.add(findFilesStage); - stages.add(cycledCountingFilter); - stages.add(typeLoggerFilter); - - // connect stages by pipes - MethodCallPipe.connect(repeaterSource.OUTPUT, findFilesStage.DIRECTORY_NAME); - MethodCallPipe.connect(findFilesStage.fileOutputPort, cycledCountingFilter.INPUT_OBJECT); - MethodCallPipe.connect(cycledCountingFilter.RELAYED_OBJECT, typeLoggerFilter.INPUT_OBJECT); - - repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); - - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return Arrays.asList(repeaterSource); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - return pipeline; - } - - @Override - public void start() { - super.start(); - try { - this.pipeline.fireStartNotification(); - } catch (final Exception e) { - e.printStackTrace(); - } - - this.pipeline.getStartStages().get(0).execute(); - - try { - this.pipeline.fireStopNotification(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - - /** - * @since 1.10 - * @param args - */ - public static void main(final String[] args) { - final CountingObjectsAnalysis analysis = new CountingObjectsAnalysis(); - analysis.init(); - final long start = System.currentTimeMillis(); - analysis.start(); - final long end = System.currentTimeMillis(); - // analysis.terminate(); - final long duration = end - start; - System.out.println("duration: " + duration + " ms"); // NOPMD (Just for example purposes) - - for (final IStage stage : analysis.pipeline.getStages()) { - if (stage instanceof AbstractFilter<?>) { -// System.out.println(stage.getClass().getName() + ": " + ((AbstractFilter<?>) stage).getOverallDurationInNs()); // NOPMD (Just for example purposes) - } - } - - @SuppressWarnings("unchecked") - final CycledCountingFilter<File> cycledCountingFilter = (CycledCountingFilter<File>) analysis.pipeline.getStages().get(2); - System.out.println("count: " + cycledCountingFilter.getCurrentCount()); // NOPMD (Just for example purposes) - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysis.java deleted file mode 100644 index 670aca5716ceb3935d2ea6688dd9378f44e0b18f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysis.java +++ /dev/null @@ -1,169 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.recordReader; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import teetime.variant.explicitScheduling.framework.concurrent.StageTerminationPolicy; -import teetime.variant.explicitScheduling.framework.concurrent.WorkerThread; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IPipe; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.framework.sequential.QueuePipe; -import teetime.variant.explicitScheduling.framework.util.BaseStage2StageExtractor; -import teetime.variant.explicitScheduling.stage.CollectorSink; -import teetime.variant.explicitScheduling.stage.kieker.File2RecordFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; - -import kieker.common.record.IMonitoringRecord; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class RecordReaderAnalysis extends Analysis { - - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - private File2RecordFilter file2RecordFilter; - private CollectorSink<IMonitoringRecord> collector; - - private ClassNameRegistryRepository classNameRegistryRepository; - - @Override - public void init() { - super.init(); - final IPipeline pipeline = this.buildPipeline(); - this.workerThread = new WorkerThread(pipeline, 0); - } - - @Override - public void start() { - super.start(); - - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } - - void setInputFile(final File file) { - this.file2RecordFilter.fileInputPort.setAssociatedPipe(new MethodCallPipe<File>(file)); - } - - private IPipeline buildPipeline() { - final BaseStage2StageExtractor baseStage2StageExtractor = new BaseStage2StageExtractor(); - - this.classNameRegistryRepository = new ClassNameRegistryRepository(); - // create stages - this.file2RecordFilter = new File2RecordFilter(this.classNameRegistryRepository); - this.collector = new CollectorSink<IMonitoringRecord>(); - - // add each stage to a stage list - final List<IStage> stages = new LinkedList<IStage>(); - stages.addAll(baseStage2StageExtractor.extract(this.file2RecordFilter)); - stages.add(this.collector); - - // connect stages by pipes - final List<IPipe<?>> pipes = new LinkedList<IPipe<?>>(); - pipes.add(this.connectWithSequentialPipe(this.file2RecordFilter.recordOutputPort, this.collector.objectInputPort)); - - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return baseStage2StageExtractor.extract(RecordReaderAnalysis.this.file2RecordFilter); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - - return pipeline; - } - - private <A extends ISource, B extends ISink<B>, T> IPipe<T> connectWithSequentialPipe(final IOutputPort<A, T> sourcePort, - final IInputPort<B, T> targetPort) { - final IPipe<T> pipe = new QueuePipe<T>(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - return pipe; - } - - WorkerThread getWorkerThread() { - return this.workerThread; - } - - public static void main(final String[] args) { - final RecordReaderAnalysis analysis = new RecordReaderAnalysis(); - analysis.init(); - final long start = System.currentTimeMillis(); - analysis.start(); - final long end = System.currentTimeMillis(); - // analysis.terminate(); - final long duration = end - start; - System.out.println("duration: " + duration + " ms"); // NOPMD (Just for example purposes) - - final IPipeline pipeline = analysis.workerThread.getPipeline(); - - for (final IStage stage : pipeline.getStages()) { - if (stage instanceof AbstractFilter<?>) { - // System.out.println(stage.getClass().getName() + ": " + ((AbstractFilter<?>) stage).getOverallDurationInNs()); // NOPMD (Just for example purposes) - } - } - } - - void setOutputRecordList(final List<IMonitoringRecord> records) { - this.collector.setObjects(records); - } - - public ClassNameRegistryRepository getClassNameRegistryRepository() { - return this.classNameRegistryRepository; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysis.java deleted file mode 100644 index 796ba92d330a2cc3c9f4b367530f9cab19607455..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysis.java +++ /dev/null @@ -1,120 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.throughput; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -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.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.Pipeline; -import teetime.variant.explicitScheduling.framework.sequential.QueuePipe; -import teetime.variant.explicitScheduling.stage.NoopFilter; -import teetime.variant.explicitScheduling.stage.basic.ObjectProducer; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ThroughputAnalysis<T> extends Analysis { - - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - private int numNoopFilters; - - private int numInputObjects; - - private Callable<T> inputObjectCreator; - - @Override - public void init() { - super.init(); - final IPipeline pipeline = this.buildPipeline(this.numNoopFilters); - - this.workerThread = new WorkerThread(pipeline, 0); - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private IPipeline buildPipeline(final int numNoopFilters) { - @SuppressWarnings("unchecked") - final NoopFilter<T>[] noopFilters = new NoopFilter[numNoopFilters]; - // create stages - final ObjectProducer<T> objectProducer = new ObjectProducer<T>(this.numInputObjects, this.inputObjectCreator); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<T>(); - } - - // 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); - } - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - @Override - public void start() { - super.start(); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - /** - * @since 1.10 - */ - public void setInput(final int numInputObjects, final Callable<T> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysis.java deleted file mode 100644 index ff70703f5d6c32896808bc2162bea928653e4bbf..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysis.java +++ /dev/null @@ -1,191 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.throughput; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; - -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.IPipeline; -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.ReservableQueuePipe; -import teetime.variant.explicitScheduling.stage.CollectorSink; -import teetime.variant.explicitScheduling.stage.NoopFilter; -import teetime.variant.explicitScheduling.stage.StartTimestampFilter; -import teetime.variant.explicitScheduling.stage.StopTimestampFilter; -import teetime.variant.explicitScheduling.stage.basic.ObjectProducer; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ThroughputTimestampAnalysis extends Analysis { - - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - private int numNoopFilters; - - private int numInputObjects; - - private Callable<TimestampObject> inputObjectCreator; - - private Collection<TimestampObject> timestampObjects; - - private boolean shouldUseQueue; - - @Override - public void init() { - super.init(); - final IPipeline pipeline = this.buildPipeline(this.numNoopFilters); - - this.workerThread = new WorkerThread(pipeline, 0); - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private IPipeline buildPipeline(final int numNoopFilters) { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>( - this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new 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); - stages.add(startTimestampFilter); - stages.addAll(Arrays.asList(noopFilters)); - stages.add(stopTimestampFilter); - stages.add(collectorSink); - - if (this.shouldUseQueue) { - // connect stages by pipes - ReservableQueuePipe.connect(objectProducer.outputPort, startTimestampFilter.inputPort); - ReservableQueuePipe.connect(startTimestampFilter.outputPort, noopFilters[0].inputPort); - for (int i = 1; i < noopFilters.length; i++) { - ReservableQueuePipe.connect(noopFilters[i - 1].outputPort, noopFilters[i].inputPort); - } - ReservableQueuePipe.connect(noopFilters[noopFilters.length - 1].outputPort, stopTimestampFilter.inputPort); - ReservableQueuePipe.connect(stopTimestampFilter.outputPort, collectorSink.objectInputPort); - } else { - startTimestampFilter.setSchedulable(false); - for (NoopFilter<TimestampObject> noopFilter : noopFilters) { - noopFilter.setSchedulable(false); - } - stopTimestampFilter.setSchedulable(false); - collectorSink.setSchedulable(false); - // 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); - } - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - @Override - public void start() { - super.start(); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - - List<Long> durationPer10000IterationsInNs = this.workerThread.getDurationPer10000IterationsInNs(); - - long overallSumInNs = 0; - for (int i = 0; i < durationPer10000IterationsInNs.size(); i++) { - overallSumInNs += durationPer10000IterationsInNs.get(i); - } - - long sumInNs = 0; - for (int i = durationPer10000IterationsInNs.size() / 2; i < durationPer10000IterationsInNs.size(); i++) { - sumInNs += durationPer10000IterationsInNs.get(i); - } - - System.out.println("Thread iterations: " + this.workerThread.getIterations() + " times"); - System.out.println("Thread execution time: " + TimeUnit.NANOSECONDS.toMillis(overallSumInNs) + " ms"); - System.out.println("Thread half duration/iterations: " + sumInNs / (this.workerThread.getIterations() / 2) - + " ns/iteration"); - System.out.println("Thread unsuccessfully executed stages: " + this.workerThread.getExecutedUnsuccessfullyCount() - + " times"); - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - /** - * @since 1.10 - */ - public void setInput(final int numInputObjects, final Callable<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public Collection<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final Collection<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } - - public boolean isShouldUseQueue() { - return this.shouldUseQueue; - } - - public void setShouldUseQueue(final boolean shouldUseQueue) { - this.shouldUseQueue = shouldUseQueue; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceAnalysis.java deleted file mode 100644 index c54039f79357e379d033adda9876770b4856845d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceAnalysis.java +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.traceReconstruction; - -import kieker.common.util.filesystem.FSUtil; - -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.explicitScheduling.stage.predicate.FileExtensionPredicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TraceAnalysis extends Analysis { - - public static void main(final String[] args) { - // FSReader reader - // StringBufferFilter stringBufferFilter - // TimestampFilter timestampFilter - // TraceIdFilter traceIdFilter - // ExecutionRecordTransformationFilter execRecTransformer - // TraceReconstructionFilter mtReconstrFilter - // EventRecordTraceReconstructionFilter eventTraceReconstructionFilter - // EventRecordTraceCounter eventRecordTraceCounter - // TraceEventRecords2ExecutionAndMessageTraceFilter traceEvents2ExecutionAndMessageTraceFilter - - new FileExtensionPredicate(FSUtil.NORMAL_FILE_EXTENSION); - - // reader -> stringBufferFilter - - // stringBufferFilter -> timestampFilter.INPUT_PORT_NAME_EXECUTION - // stringBufferFilter -> timestampFilter.INPUT_PORT_NAME_FLOW - // timestampFilter -> traceIdFilter - - // traceIdFilter -> execRecTransformer - // execRecTransformer -> SYSTEM_ENTITY_FACTORY - - // mtReconstrFilter -> SYSTEM_ENTITY_FACTORY - // execRecTransformer -> mtReconstrFilter - - // traceIdFilter -> eventTraceReconstructionFilter - // eventTraceReconstructionFilter -> eventRecordTraceCounter.INPUT_PORT_NAME_VALID - // eventTraceReconstructionFilter -> eventRecordTraceCounter.INPUT_PORT_NAME_INVALID - - // eventTraceReconstructionFilter -> traceEvents2ExecutionAndMessageTraceFilter - // traceEvents2ExecutionAndMessageTraceFilter -> SYSTEM_ENTITY_FACTORY - } - - @Override - public void init() { - // TODO - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis.java b/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis.java deleted file mode 100644 index bd24e17efce9f265dac680e9e5a5e8c2ff13aa2e..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis.java +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.traceReconstruction; - -import java.util.LinkedList; -import java.util.List; - -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.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.stage.FileExtensionFilter; -import teetime.variant.explicitScheduling.stage.io.File2TextLinesFilter; -import teetime.variant.explicitScheduling.stage.kieker.MonitoringLogDirectory2Files; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TraceReconstructionAnalysis extends Analysis { - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - private ClassNameRegistryRepository classNameRegistryRepository; - - @Override - public void init() { - super.init(); - final IPipeline pipeline = this.buildPipeline(); - this.workerThread = new WorkerThread(pipeline, 0); - } - - /** - * @since 1.10 - */ - private IPipeline buildPipeline() { - final ClassNameRegistryCreationFilter classNameRegistryCreationFilter = new ClassNameRegistryCreationFilter(this.classNameRegistryRepository); - final MonitoringLogDirectory2Files directory2FilesFilter = new MonitoringLogDirectory2Files(); - final FileExtensionFilter fileExtensionFilter = new FileExtensionFilter(); - final File2TextLinesFilter file2TextLinesFilter = new File2TextLinesFilter(); - final TextLine2RecordFilter textLine2RecordFilter = new TextLine2RecordFilter(this.classNameRegistryRepository); - - // TODO Auto-generated method stub - - // add each stage to a stage list - final LinkedList<IStage> startStages = new LinkedList<IStage>(); - - final List<IStage> stages = new LinkedList<IStage>(); - - final IPipeline pipeline = new IPipeline() { - @Override - public List<? extends IStage> getStartStages() { - return startStages; - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - - return pipeline; - } - - @Override - public void start() { - super.start(); - - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis2.java b/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis2.java deleted file mode 100644 index 8ae9a9ef6b3b58b11b60bd0df1a3d2cd92880cad..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/examples/traceReconstruction/TraceReconstructionAnalysis2.java +++ /dev/null @@ -1,163 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.traceReconstruction; - -import java.util.LinkedList; -import java.util.List; - -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.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.Pipeline; -import teetime.variant.explicitScheduling.framework.sequential.QueuePipe; -import teetime.variant.explicitScheduling.stage.Cache; -import teetime.variant.explicitScheduling.stage.CountingFilter; -import teetime.variant.explicitScheduling.stage.InstanceOfFilter; -import teetime.variant.explicitScheduling.stage.io.File2TextLinesFilter; -import teetime.variant.explicitScheduling.stage.kieker.MonitoringLogDirectory2Files; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; -import teetime.variant.explicitScheduling.stage.kieker.traceReconstruction.TraceReconstructionFilter; -import teetime.variant.explicitScheduling.stage.predicate.IsIMonitoringRecordInRange; -import teetime.variant.explicitScheduling.stage.predicate.IsOperationExecutionRecordTraceIdPredicate; -import teetime.variant.explicitScheduling.stage.predicate.PredicateFilter; -import teetime.variant.explicitScheduling.stage.stringBuffer.StringBufferFilter; -import teetime.variant.explicitScheduling.stage.stringBuffer.handler.IMonitoringRecordHandler; -import teetime.variant.explicitScheduling.stage.stringBuffer.handler.StringHandler; -import teetime.variant.explicitScheduling.stage.util.TextLine; - -import kieker.analysis.plugin.filter.flow.TraceEventRecords; -import kieker.common.record.IMonitoringRecord; -import kieker.common.record.controlflow.OperationExecutionRecord; -import kieker.common.record.flow.IFlowRecord; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TraceReconstructionAnalysis2 extends Analysis { - private static final int SECONDS = 1000; - - private WorkerThread workerThread; - - private ClassNameRegistryRepository classNameRegistryRepository; - - @Override - public void init() { - super.init(); - // IPipeline clockPipeline = buildClockPipeline(); - // this.clockThread = new WorkerThread(clockPipeline, 1); - // Clock clockStage=(Clock) clockPipeline.getStartStages().get(0); - - final IPipeline pipeline = this.buildPipeline(); - this.workerThread = new WorkerThread(pipeline, 0); - } - - /** - * @param clockStage - * @since 1.10 - */ - private IPipeline buildPipeline() { - // predicates TODO - final IsIMonitoringRecordInRange isIMonitoringRecordInRange = new IsIMonitoringRecordInRange(0, 1000); - final IsOperationExecutionRecordTraceIdPredicate isOperationExecutionRecordTraceIdPredicate = new IsOperationExecutionRecordTraceIdPredicate( - false, null); - - final ClassNameRegistryCreationFilter classNameRegistryCreationFilter = new ClassNameRegistryCreationFilter( - this.classNameRegistryRepository); - final MonitoringLogDirectory2Files directory2FilesFilter = new MonitoringLogDirectory2Files(); - final File2TextLinesFilter file2TextLinesFilter = new File2TextLinesFilter(); - final Cache<TextLine> cache = new Cache<TextLine>(); - - final TextLine2RecordFilter textLine2RecordFilter = new TextLine2RecordFilter(this.classNameRegistryRepository); - final StringBufferFilter<IMonitoringRecord> stringBufferFilter = new StringBufferFilter<IMonitoringRecord>(); - final PredicateFilter<IMonitoringRecord> timestampFilter = new PredicateFilter<IMonitoringRecord>( - isIMonitoringRecordInRange); - final PredicateFilter<OperationExecutionRecord> traceIdFilter = new PredicateFilter<OperationExecutionRecord>( - isOperationExecutionRecordTraceIdPredicate); - final InstanceOfFilter<IMonitoringRecord, IFlowRecord> instanceOfFilter = new InstanceOfFilter<IMonitoringRecord, IFlowRecord>( - IFlowRecord.class); - final TraceReconstructionFilter traceReconstructionFilter = new TraceReconstructionFilter(); - final CountingFilter<TraceEventRecords> countingFilter = new CountingFilter<TraceEventRecords>(); - - // configure stages - stringBufferFilter.getDataTypeHandlers().add(new IMonitoringRecordHandler()); - stringBufferFilter.getDataTypeHandlers().add(new StringHandler()); - - // add each stage to a stage list - final LinkedList<IStage> startStages = new LinkedList<IStage>(); - startStages.add(classNameRegistryCreationFilter); - - final List<IStage> stages = new LinkedList<IStage>(); - stages.add(classNameRegistryCreationFilter); - stages.add(directory2FilesFilter); - stages.add(file2TextLinesFilter); - stages.add(cache); - - stages.add(textLine2RecordFilter); - stages.add(stringBufferFilter); - stages.add(timestampFilter); - stages.add(traceIdFilter); - stages.add(instanceOfFilter); - stages.add(traceReconstructionFilter); - stages.add(countingFilter); - - // connect pipes - QueuePipe.connect(classNameRegistryCreationFilter.filePrefixOutputPort, - directory2FilesFilter.filePrefixInputPort); - QueuePipe.connect(classNameRegistryCreationFilter.relayDirectoryOutputPort, - directory2FilesFilter.directoryInputPort); - QueuePipe.connect(directory2FilesFilter.fileOutputPort, file2TextLinesFilter.fileInputPort); - QueuePipe.connect(file2TextLinesFilter.textLineOutputPort, cache.objectInputPort); - // QueuePipe.connect(XXX, cache.sendInputPort); - QueuePipe.connect(cache.objectOutputPort, textLine2RecordFilter.textLineInputPort); - QueuePipe.connect(textLine2RecordFilter.recordOutputPort, stringBufferFilter.objectInputPort); - QueuePipe.connect(stringBufferFilter.objectOutputPort, timestampFilter.inputPort); - // QueuePipe.connect(timestampFilter.matchingOutputPort, traceIdFilter.inputPort); - // QueuePipe.connect(timestampFilter.mismatchingOutputPort, YYY); // ignore this case - QueuePipe.connect(traceIdFilter.matchingOutputPort, instanceOfFilter.inputPort); - // QueuePipe.connect(traceIdFilter.mismatchingOutputPort, traceIdFilter.inputPort); // ignore this case - // QueuePipe.connect(clockStage.timestampOutputPort, traceReconstructionFilter.timestampInputPort); // ignore - // this case - QueuePipe.connect(instanceOfFilter.matchingOutputPort, traceReconstructionFilter.recordInputPort); - // QueuePipe.connect(instanceOfFilter.mismatchingOutputPort, instanceOfFilter.inputPort); // ignore this case - QueuePipe.connect(traceReconstructionFilter.traceValidOutputPort, countingFilter.INPUT_OBJECT); - // QueuePipe.connect(traceReconstructionFilter.traceInvalidOutputPort, ); // ignore this case - - final Pipeline pipeline = new Pipeline(); - pipeline.setStartStages(startStages); - pipeline.setStages(stages); - return pipeline; - } - - @Override - public void start() { - super.start(); - - this.workerThread.setTerminationPolicy(StageTerminationPolicy.TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION); - - this.workerThread.start(); - try { - this.workerThread.join(60 * SECONDS); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentPipeline.java.todo b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentPipeline.java.todo deleted file mode 100644 index 07cbd64e85f333296469a7105461eba7206996bf..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentPipeline.java.todo +++ /dev/null @@ -1,157 +0,0 @@ -package kieker.panalysis.framework.concurrent; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import kieker.panalysis.framework.core.IInputPort; -import kieker.panalysis.framework.core.IOutputPort; -import kieker.panalysis.framework.core.IPipe; -import kieker.panalysis.framework.core.ISink; -import kieker.panalysis.framework.core.ISource; -import kieker.panalysis.framework.core.IStage; - -public class ConcurrentPipeline { - - private final Map<IOutputPort<?, ?>, IInputPort<?, ?>> connections = new HashMap<IOutputPort<?, ?>, IInputPort<?, ?>>(); - private final Set<IStage> ioStages = new HashSet<IStage>(); - private final Map<IStage, List<IStage>> standardStages = new HashMap<IStage, List<IStage>>(); - - private final int numCores = Runtime.getRuntime().availableProcessors(); - private int defaultBundleSize = 64; - - public <T> void connect(final IOutputPort<?, T> sourcePort, final IInputPort<?, T> targetPort, final int bundleSize) { - this.connections.put(sourcePort, targetPort); - this.addStage(sourcePort.getOwningStage()); - this.addStage(targetPort.getOwningStage()); - } - - /** - * Connects to ports using the default bundle size - * - * @param sourcePort - * @param targetPort - */ - public <T> void connect(final IOutputPort<?, T> sourcePort, final IInputPort<?, T> targetPort) { - this.connect(sourcePort, targetPort, this.defaultBundleSize); - } - - private void addStage(final IStage owningStage) { - if (owningStage instanceof IoStage) { - this.ioStages.add(owningStage); - } else { - this.standardStages.put(owningStage, null); - } - } - - public void start() { - this.cloneNonIoStages(); - this.connectConcurrentStages(); - this.instantiatePipes(); - } - - private void cloneNonIoStages() { - for (final Entry<IStage, List<IStage>> entry : this.standardStages.entrySet()) { - final List<IStage> concurrentStages = this.createConcurrentStages(entry.getKey()); - entry.setValue(concurrentStages); - } - } - - private List<IStage> createConcurrentStages(final IStage stage) { - final List<IStage> concurrentStages = new LinkedList<IStage>(); - for (int i = 0; i < this.numCores; i++) { - final Class<? extends IStage> stageClazz = stage.getClass(); - // final Constructor<? extends IStage> constructor = stageClazz.getConstructor(Configuration.class); - // final IStage copiedStage = constructor.newInstance(stage.getConfiguration()); // copy by reference since the configuration is read-only - - IStage copiedStage; - try { - copiedStage = stageClazz.newInstance(); - } catch (final InstantiationException e) { - throw new IllegalStateException("The stage to be copied requires a constructor without any parameters.", e); - } catch (final IllegalAccessException e) { - throw new IllegalStateException("The stage to be copied requires a constructor without any parameters.", e); - } - copiedStage.copyAttributes(stage); - concurrentStages.add(copiedStage); - } - return concurrentStages; - } - - private void connectConcurrentStages() { - for (final Entry<IOutputPort<?, ?>, IInputPort<?, ?>> entry : this.connections.entrySet()) { - final IOutputPort<?, ?> sourcePort = entry.getKey(); - final IInputPort<?, ?> targetPort = entry.getValue(); - - final boolean isSourceIoStage = sourcePort.getOwningStage() instanceof IoStage; - final boolean isTargetIoStage = targetPort.getOwningStage() instanceof IoStage; - - if (isSourceIoStage && !isTargetIoStage) { - final List<IStage> concurrentStages = this.standardStages.get(targetPort.getOwningStage()); - final IStage owningSourceStage = sourcePort.getOwningStage(); - for (final IStage concurrentTargetStage : concurrentStages) { - this.connections.put(owningSourceStage.getNewOutputPort(), concurrentTargetStage.getInputPortByIndex(targetPort.getIndex())); - } - } else if (!isSourceIoStage && isTargetIoStage) { - final List<IStage> concurrentStages = this.standardStages.get(sourcePort.getOwningStage()); - final IStage owningTargetStage = targetPort.getOwningStage(); - for (final IStage s : concurrentStages) { - this.connections.put(s.getOutputPortByIndex(sourcePort.getIndex()), owningTargetStage.getNewInputPort()); - } - } else { - final List<IStage> concurrentSourceStages = this.standardStages.get(sourcePort.getOwningStage()); - final List<IStage> concurrentTargetStages = this.standardStages.get(targetPort.getOwningStage()); - for (int i = 0; i < concurrentSourceStages.size(); i++) { - final IStage sourceStage = concurrentSourceStages.get(i); - final IOutputPort<?, ?> otherSourcePort = sourceStage.getOutputPortByIndex(sourcePort.getIndex()); - - final IStage targetStage = concurrentTargetStages.get(i); - final IInputPort<?, ?> otherTargetPort = targetStage.getInputPortByIndex(targetPort.getIndex()); - - this.connections.put(otherSourcePort, otherTargetPort); - } - } - } - } - - @SuppressWarnings("unchecked") - private <T, S0 extends ISource, S1 extends ISink<S1>> void instantiatePipes() { - for (final Entry<IOutputPort<?, ?>, IInputPort<?, ?>> entry : this.connections.entrySet()) { - final IOutputPort<S0, T> sourcePort = (IOutputPort<S0, T>) entry.getKey(); - final IInputPort<S1, T> targetPort = (IInputPort<S1, T>) entry.getValue(); - this.instantiatePipe(sourcePort, targetPort); - } - } - - private <T, P extends IPipe<T>, S0 extends ISource, S1 extends ISink<S1>> - void instantiatePipe(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - final boolean isSourceIoStage = sourcePort.getOwningStage() instanceof IoStage; - final boolean isTargetIoStage = targetPort.getOwningStage() instanceof IoStage; - - IPipe<T> pipe; - if (isSourceIoStage && !isTargetIoStage) { - pipe = new ConcurrentWorkStealingPipe<T>(); - } else if (!isSourceIoStage && isTargetIoStage) { - pipe = new SingleProducerSingleConsumerPipe<T>(); - } else if (isSourceIoStage && isTargetIoStage) { - throw new IllegalStateException("It is not allowed to connect two I/O stages."); - } else { - pipe = new ConcurrentWorkStealingPipe<T>(); - } - - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - public void setDefaultBundleSize(final int defaultBundleSize) { - this.defaultBundleSize = defaultBundleSize; - } - - public int getDefaultBundleSize() { - return this.defaultBundleSize; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipe.java deleted file mode 100644 index 587d2990254f6c2b9af9a319120cf2ca29f45432..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipe.java +++ /dev/null @@ -1,145 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.LinkedList; -import java.util.List; - -import teetime.util.concurrent.workstealing.CircularWorkStealingDeque; -import teetime.variant.explicitScheduling.framework.concurrent.steal.IStealStrategy; -import teetime.variant.explicitScheduling.framework.core.AbstractPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ConcurrentWorkStealingPipe<T> extends AbstractPipe<T> { - - private final CircularWorkStealingDeque<T> circularWorkStealingDeque = new CircularWorkStealingDeque<T>(); - private final IStealStrategy<T> stealStrategy; - - // BETTER use a prioritized list that considers - // <ul> - // <li>the size of each deque to minimize steals - // <li>the core's locality to improve cache access performance - // </ul> - - private List<ConcurrentWorkStealingPipe<T>> pipesToStealFrom; - private int numTakenElements = 0; - - ConcurrentWorkStealingPipe(final IStealStrategy<T> stealStrategy) { - this.stealStrategy = stealStrategy; - } - - public <S0 extends ISource, S1 extends ISink<S1>> void connect(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - this.setSourcePort(sourcePort); - this.setTargetPort(targetPort); - } - - @Override - protected void putInternal(final T token) { - this.circularWorkStealingDeque.pushBottom(token); - } - - public void putMultiple(final List<T> elements) { - this.circularWorkStealingDeque.pushBottomMultiple(elements); - } - - @Override - protected T tryTakeInternal() { - T record = this.circularWorkStealingDeque.popBottom(); - if (record == null) { - record = this.stealStrategy.steal(this.getTargetPort(), this.pipesToStealFrom); - if (record == null) { - return null; - } - System.out.println("stolen (" + Thread.currentThread() + "): " + record); - } - this.numTakenElements++; - return record; - } - - public T take() { - T record = this.circularWorkStealingDeque.popBottomEx(); - if (record == null) { - record = this.stealStrategy.steal(this.getTargetPort(), this.pipesToStealFrom); - if (record == null) { - return null; - } - } - this.numTakenElements++; - return record; - } - - public List<T> tryTakeMultiple(final int maxItemsToTake) { - // TODO Auto-generated method stub - // BETTER find a way to take multiple elements directly without a loop - return null; - } - - public T read() { - final T record = this.circularWorkStealingDeque.readBottom(); - return record; - } - - public boolean isEmpty() { - return this.circularWorkStealingDeque.isEmpty(); - } - - public T steal() { - return this.circularWorkStealingDeque.steal(); - } - - public List<T> stealMultiple(final int maxItemsToSteal) { - int maxItemsToStealCounter = maxItemsToSteal; - final List<T> stolenElements = new LinkedList<T>(); - while (maxItemsToStealCounter-- > 0) { - final T stolenElement = this.steal(); - if (stolenElement == null) { - break; - } - stolenElements.add(stolenElement); - } - // BETTER find a way to steal multiple elements directly without a loop - return stolenElements; - } - - public List<ConcurrentWorkStealingPipe<T>> getPipesToStealFrom() { - return this.pipesToStealFrom; - } - - public void setPipesToStealFrom(final List<ConcurrentWorkStealingPipe<T>> pipesToStealFrom) { - this.pipesToStealFrom = pipesToStealFrom; - } - - @Override - public void onPipelineStarts() { - this.pipesToStealFrom = new LinkedList<ConcurrentWorkStealingPipe<T>>(this.pipesToStealFrom); - this.pipesToStealFrom.remove(this); - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + "={" + "numTakenElements=" + this.numTakenElements + "}"; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipeFactory.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipeFactory.java deleted file mode 100644 index 8251942c427a8d9629d0b5441fcc98344f346a6d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/ConcurrentWorkStealingPipeFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.LinkedList; -import java.util.List; - -import teetime.variant.explicitScheduling.framework.concurrent.steal.IStealStrategy; -import teetime.variant.explicitScheduling.framework.concurrent.steal.StealIfEmptyStrategy; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ConcurrentWorkStealingPipeFactory<T> { - - private final List<ConcurrentWorkStealingPipe<T>> pipes = new LinkedList<ConcurrentWorkStealingPipe<T>>(); - private final IStealStrategy<T> stealStrategy = new StealIfEmptyStrategy<T>(); - - public ConcurrentWorkStealingPipe<T> create() { - final ConcurrentWorkStealingPipe<T> pipe = new ConcurrentWorkStealingPipe<T>(this.stealStrategy); - pipe.setPipesToStealFrom(this.pipes); - - this.pipes.add(pipe); - - return pipe; - } - - public List<ConcurrentWorkStealingPipe<T>> getPipes() { - return this.pipes; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageScheduler.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageScheduler.java deleted file mode 100644 index cfbb5e809d6bf26c4e4f105ab0f9958cebdc2c17..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageScheduler.java +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IStageScheduler { - - public abstract IStage get(); - - public abstract boolean isAnyStageActive(); - - public abstract void disable(IStage stage); - - public abstract void determineNextStage(IStage stage, boolean executedSuccessfully); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageWorkList.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageWorkList.java deleted file mode 100644 index d0d1fc1e868d08aea48665e23e868c264200e813..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/IStageWorkList.java +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IStageWorkList { - - public abstract void pushAll(Collection<? extends IStage> stages); - - public abstract void pushAll(IOutputPort<?, ?>[] outputPorts); - - public abstract IStage pop(); - - public abstract IStage read(); - - public abstract boolean isEmpty(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/SingleProducerSingleConsumerPipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/SingleProducerSingleConsumerPipe.java deleted file mode 100644 index b3a43f381ca969372480b428bed0bff9f7f38f24..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/SingleProducerSingleConsumerPipe.java +++ /dev/null @@ -1,84 +0,0 @@ -package teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.List; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Callable; -import java.util.concurrent.LinkedBlockingDeque; - -import teetime.util.concurrent.workstealing.CircularWorkStealingDeque; -import teetime.variant.explicitScheduling.framework.core.AbstractPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; - -public class SingleProducerSingleConsumerPipe<T> extends AbstractPipe<T> { - - // BETTER use a cache-aware queue (see the corresponding paper) - final BlockingQueue<T> queue = new LinkedBlockingDeque<T>(); - - private final Callable<T> blockingTake = new Callable<T>() { - public T call() throws Exception { - return SingleProducerSingleConsumerPipe.this.queue.take(); - } - }; - private final Callable<T> nonBlockingTake = new Callable<T>() { - public T call() throws Exception { - return SingleProducerSingleConsumerPipe.this.queue.poll(); - } - }; - private volatile Callable<T> take = this.blockingTake; - - public static <S0 extends ISource, S1 extends ISink<S1>, T> void connect(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - final SingleProducerSingleConsumerPipe<T> pipe = new SingleProducerSingleConsumerPipe<T>(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - public void putMultiple(final List<T> elements) { - this.queue.addAll(elements); - } - - public T read() { - return this.queue.peek(); - } - - public List<?> tryTakeMultiple(final int numElementsToTake) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected void putInternal(final T token) { - this.queue.add(token); - } - - @Override - protected T tryTakeInternal() { - try { - return this.take.call(); - } catch (final Exception e) { - return null; - } - } - - public T take() { - final T token = this.tryTake(); - if (token == null) { - throw CircularWorkStealingDeque.DEQUE_IS_EMPTY_EXCEPTION; - } - return token; - } - - public boolean isEmpty() { - return this.queue.isEmpty(); - } - - @Override - public void close() { - this.take = this.nonBlockingTake; - super.close(); - this.getTargetPort().getOwningStage().getOwningThread().interrupt(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageTerminationPolicy.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageTerminationPolicy.java deleted file mode 100644 index 2a14fd8e60a950c0e058a477ca176c1814e998e5..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageTerminationPolicy.java +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public enum StageTerminationPolicy { - - TERMINATE_STAGE_NOW, - TERMINATE_STAGE_AFTER_NEXT_EXECUTION, - TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION, - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkArrayList.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkArrayList.java deleted file mode 100644 index a8b48e2ae457c63c49a97cc65fbb3dfc2f0468fd..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkArrayList.java +++ /dev/null @@ -1,124 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StageWorkArrayList implements IStageWorkList { - - private static class SchedulableStage { - public SchedulableStage() {} - - public IStage stage; - public int numToBeExecuted; - } - - private final int accessesDeviceId; - - /** sorted array where the last stage has highest priority */ - private final SchedulableStage[] stages; - private int firstIndex = Integer.MAX_VALUE; - private int lastIndex = -1; - - /** - * @since 1.10 - */ - public StageWorkArrayList(final IPipeline pipeline, final int accessesDeviceId) { - this.accessesDeviceId = accessesDeviceId; - - this.stages = new SchedulableStage[pipeline.getStages().size()]; - for (IStage stage : pipeline.getStages()) { - final SchedulableStage schedulableStage = new SchedulableStage(); - schedulableStage.stage = stage; - schedulableStage.numToBeExecuted = 0; - this.stages[stage.getSchedulingIndex()] = schedulableStage; - } - } - - @Override - public void pushAll(final Collection<? extends IStage> stages) { - for (final IStage stage : stages) { - this.push(stage); - } - } - - @Override - public void pushAll(final IOutputPort<?, ?>[] outputPorts) { - for (final IOutputPort<?, ?> outputPort : outputPorts) { - if (outputPort != null) { - final IStage targetStage = outputPort.getAssociatedPipe().getTargetPort().getOwningStage(); - this.push(targetStage); - } - } - } - - private void push(final IStage stage) { - if (stage.isSchedulable() && this.isValid(stage)) { - this.firstIndex = Math.min(stage.getSchedulingIndex(), this.firstIndex); - this.lastIndex = Math.max(stage.getSchedulingIndex(), this.lastIndex); - this.stages[stage.getSchedulingIndex()].numToBeExecuted++; - } - } - - private boolean isValid(final IStage stage) { - final boolean isValid = (stage.getAccessesDeviceId() == this.accessesDeviceId); - if (!isValid) { - // LOG.warn("Invalid stage: stage.accessesDeviceId = " + stage.getAccessesDeviceId() + ", accessesDeviceId = " + this.accessesDeviceId + ", stage = " + - // stage); - } - return isValid; - } - - @Override - public IStage pop() { - final SchedulableStage schedulableStage = this.stages[this.lastIndex]; - // schedulableStage.numToBeExecuted--; - schedulableStage.numToBeExecuted = 0; - cond: if (schedulableStage.numToBeExecuted == 0) - { - for (int i = this.lastIndex - 1; i >= this.firstIndex; i--) { - if (this.stages[i].numToBeExecuted > 0) { - this.lastIndex = i; - break cond; - } - } - this.firstIndex = Integer.MAX_VALUE; - this.lastIndex = -1; - } - return schedulableStage.stage; - } - - @Override - public IStage read() { - final SchedulableStage schedulableStage = this.stages[this.lastIndex]; - return schedulableStage.stage; - } - - @Override - public boolean isEmpty() { - return this.lastIndex == -1; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkList.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkList.java deleted file mode 100644 index 34d461975ca43f81e4aff920e1b033a08b7219a5..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/StageWorkList.java +++ /dev/null @@ -1,83 +0,0 @@ -package teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IStage; - -@Deprecated -public class StageWorkList implements IStageWorkList { - - // private static final Log LOG = LogFactory.getLog(StageWorkList.class); - - private final List<IStage> workList; - private final int accessesDeviceId; - - public StageWorkList(final int accessesDeviceId, final int initialCapacity) { - this.accessesDeviceId = accessesDeviceId; - this.workList = new ArrayList<IStage>(initialCapacity); - } - - @Override - public void pushAll(final Collection<? extends IStage> stages) { - this.addAll(0, stages); - } - - @Override - public IStage pop() { - return this.workList.remove(0); - } - - @Override - public IStage read() { - return this.workList.get(0); - } - - @Override - public boolean isEmpty() { - return this.workList.isEmpty(); - } - - private boolean isValid(final IStage stage) { - final boolean isValid = (stage.getAccessesDeviceId() == this.accessesDeviceId); - if (!isValid) { - // LOG.warn("Invalid stage: stage.accessesDeviceId = " + stage.getAccessesDeviceId() + ", accessesDeviceId = " + this.accessesDeviceId + ", stage = " + - // stage); - } - return isValid; - } - - private boolean addAll(final int index, final Collection<? extends IStage> collection) { - final Collection<IStage> filteredCollection = new ArrayList<IStage>(collection.size()); - for (final IStage stage : collection) { - this.push(filteredCollection, stage); - } - return this.workList.addAll(index, filteredCollection); - } - - private void push(final Collection<IStage> filteredCollection, final IStage stage) { - if (this.isValid(stage)) { - filteredCollection.add(stage); - } - } - - @Override - public String toString() { - return this.workList.toString(); - } - - @Override - public void pushAll(final IOutputPort<?, ?>[] outputPorts) { - final Collection<IStage> filteredCollection = new ArrayList<IStage>(outputPorts.length); - for (final IOutputPort<?, ?> outputPort : outputPorts) { - if (outputPort != null) { - final IStage targetStage = outputPort.getAssociatedPipe().getTargetPort().getOwningStage(); - this.push(filteredCollection, targetStage); - } - } - this.workList.addAll(0, filteredCollection); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/TokenBundle.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/TokenBundle.java deleted file mode 100644 index 160145983457900df50655defeb600235de9e4c7..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/TokenBundle.java +++ /dev/null @@ -1,16 +0,0 @@ -package teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.List; - -public class TokenBundle<T> { - - private final List<T> tokens; - - public TokenBundle(final List<T> tokens) { - this.tokens = tokens; - } - - public List<T> getTokens() { - return this.tokens; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/WorkerThread.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/WorkerThread.java deleted file mode 100644 index 5686013208333861d5b7a9b84985bc10e38fd812..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/WorkerThread.java +++ /dev/null @@ -1,281 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.StopWatch; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IPipe; -import teetime.variant.explicitScheduling.framework.core.IPipeCommand; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.core.IInputPort.PortState; -import teetime.variant.explicitScheduling.framework.scheduling.NextStageScheduler; -import teetime.variant.explicitScheduling.framework.scheduling.StageStateManager; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class WorkerThread extends Thread { - - private static final int NUM_ITERATIONS_TO_MEASURE = 100000; - - private final IPipeline pipeline; - private IStageScheduler stageScheduler; - private StageStateManager stageStateManager; - - private StageTerminationPolicy terminationPolicy; - private boolean shouldTerminate = false; - private final int accessesDeviceId; - private int executedUnsuccessfullyCount; - - // statistics - private final StopWatch stopWatch = new StopWatch(); - private final List<Long> durationPerXIterationsInNs = new LinkedList<Long>(); - private int iterations; - - private final StopWatch afterStageExecutionStopWatch = new StopWatch(); - - private final List<Long> afterStageExecutions = new LinkedList<Long>(); - - public WorkerThread(final IPipeline pipeline, final int accessesDeviceId) { - this.pipeline = pipeline; - this.accessesDeviceId = accessesDeviceId; - } - - private void initStages(final IPipeline pipeline) { - for (final IStage stage : pipeline.getStages()) { - stage.setOwningThread(this); - } - - this.setDepthForEachStage(pipeline); - this.setSchedulingIndexForEachhStage(pipeline); - } - - private void setDepthForEachStage(final IPipeline pipeline) { - final IPipeCommand setDepthCommand = new IPipeCommand() { - @Override - public void execute(final IPipe<?> pipe) throws Exception { - final IStage sourceStage = pipe.getSourcePort().getOwningStage(); - final IStage owningStage = pipe.getTargetPort().getOwningStage(); - if (owningStage.getDepth() == IStage.DEPTH_NOT_SET) { - owningStage.setDepth(sourceStage.getDepth() + 1); - owningStage.notifyOutputPipes(this); - } - } - }; - - for (final IStage startStage : pipeline.getStartStages()) { - startStage.setDepth(0); - } - - for (final IStage startStage : pipeline.getStartStages()) { - try { - startStage.notifyOutputPipes(setDepthCommand); - } catch (final Exception e) { - throw new IllegalStateException("may not happen", e); - } - } - } - - private List<IStage> setSchedulingIndexForEachhStage(final IPipeline pipeline) { - final List<IStage> stageList = new ArrayList<IStage>(pipeline.getStages()); - - final Comparator<? super IStage> depthComparator = new Comparator<IStage>() { - @Override - public int compare(final IStage o1, final IStage o2) { - if (o1.getDepth() == o2.getDepth()) { - return 0; - } else if (o1.getDepth() < o2.getDepth()) { - return -1; - } else { - return 1; - } - } - }; - - Collections.sort(stageList, depthComparator); - - for (int i = 0; i < stageList.size(); i++) { - stageList.get(i).setSchedulingIndex(i); - } - - return stageList; - } - - @Override - public void run() { - try { - this.initDatastructures(); - } catch (final Exception e) { - throw new IllegalStateException(e); - } - - this.iterations = 0; - this.stopWatch.start(); - - while (this.stageScheduler.isAnyStageActive()) { - this.iterations++; - // this.iterationStopWatch.start(); - - // beforeStageExecutionStopWatch.start(); - - final IStage stage = this.stageScheduler.get(); - - // beforeStageExecutionStopWatch.end(); - - this.startStageExecution(stage); - // stageExecutionStopWatch.start(); - final boolean executedSuccessfully = stage.execute(); - // stageExecutionStopWatch.end(); - this.finishStageExecution(stage, executedSuccessfully); - - // this.afterStageExecutionStopWatch.start(); - - if (this.shouldTerminate) { - this.executeTerminationPolicy(stage, executedSuccessfully); - } - this.stageScheduler.determineNextStage(stage, executedSuccessfully); - - // this.afterStageExecutionStopWatch.end(); - - // this.iterationStopWatch.end(); - - // all stop watches are activated - // final long schedulingOverhead = this.iterationStopWatch.getDurationInNs() - - // stageExecutionStopWatch.getDurationInNs(); //4952 - - // 6268 -> 5350 (w/o after) -> 4450 (w/o before) -> 3800 (w/o stage) - // final long schedulingOverhead = this.iterationStopWatch.getDurationInNs(); - // final long schedulingOverhead = beforeStageExecutionStopWatch.getDurationInNs(); //327 - // final long schedulingOverhead = stageExecutionStopWatch.getDurationInNs(); //1416 - // final long schedulingOverhead = this.afterStageExecutionStopWatch.getDurationInNs(); // 2450 - - // if (this.iterations > 50000 && this.iterations % 1000 == 0) - // this.afterStageExecutions.add(this.afterStageExecutionStopWatch.getDurationInNs()); - - // rest: ~2000 (measurement overhead?) - if ((this.iterations % NUM_ITERATIONS_TO_MEASURE) == 0) { - this.stopWatch.end(); - this.durationPerXIterationsInNs.add(this.stopWatch.getDurationInNs()); - this.stopWatch.start(); - } - } - - this.stopWatch.end(); - this.durationPerXIterationsInNs.add(this.stopWatch.getDurationInNs()); - - // System.out.println("avg: " + StatisticsUtil.calculateAverage(this.afterStageExecutions) + " ns"); - - this.cleanUpDatastructures(); - } - - private void executeTerminationPolicy(final IStage executedStage, final boolean executedSuccessfully) { - // System.out.println("executeTerminationPolicy executedStage=" + executedStage + ", executedSuccessfully=" + executedSuccessfully); - // System.out.println("executeTerminationPolicy areAllInputPortsClosed(executedStage)=" + this.stageStateManager.areAllInputPortsClosed(executedStage)); - - switch (this.terminationPolicy) { - case TERMINATE_STAGE_AFTER_NEXT_EXECUTION: - if (this.stageStateManager.areAllInputPortsClosed(executedStage)) { - this.stageScheduler.disable(executedStage); - } - break; - case TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION: - if (!executedSuccessfully) { - if (this.stageStateManager.areAllInputPortsClosed(executedStage)) { - this.stageScheduler.disable(executedStage); - } - } - break; - case TERMINATE_STAGE_NOW: - for (final IStage stage : this.pipeline.getStages()) { - this.stageScheduler.disable(stage); - } - break; - default: - break; - } - } - - private void initDatastructures() throws Exception { - // stages need to be initialized here, because in a concurrent context some stages (e.g., a merger) is executed after its pipeline has been created. - this.initStages(this.pipeline); - this.stageStateManager = new StageStateManager(this.pipeline); - this.stageScheduler = new NextStageScheduler(this.pipeline, this.accessesDeviceId, this.stageStateManager); - - for (final IStage startStage : this.pipeline.getStartStages()) { - for (IInputPort<IStage, ?> inputPort : startStage.getInputPorts()) { - if (inputPort.getState() == PortState.CLOSED) { - inputPort.close(); - } - } - } - - this.pipeline.fireStartNotification(); - } - - private final void startStageExecution(final IStage stage) { - // System.out.println("Executing stage: " + stage); - } - - private final void finishStageExecution(final IStage stage, final boolean executedSuccessfully) { - if (!executedSuccessfully) { // statistics - this.executedUnsuccessfullyCount++; - } - } - - private void cleanUpDatastructures() { - this.pipeline.fireStopNotification(); - } - - public IPipeline getPipeline() { - return this.pipeline; - } - - /** - * If not set, this thread will run infinitely. - * - * @param terminationPolicyToUse - */ - public void setTerminationPolicy(final StageTerminationPolicy terminationPolicyToUse) { - this.terminationPolicy = terminationPolicyToUse; - this.shouldTerminate = true; - } - - public int getExecutedUnsuccessfullyCount() { - return this.executedUnsuccessfullyCount; - } - - public List<Long> getDurationPer10000IterationsInNs() { - return this.durationPerXIterationsInNs; - } - - /** - * @since 1.10 - */ - public int getIterations() { - return this.iterations; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/IStealStrategy.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/IStealStrategy.java deleted file mode 100644 index 378b693f6fc1086caed68c1c180d775d31ca39c2..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/IStealStrategy.java +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent.steal; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IStealStrategy<T> { - - <S extends IStage> T steal(IInputPort<S, T> inputPort, Collection<ConcurrentWorkStealingPipe<T>> pipesToStealFrom); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/StealIfEmptyStrategy.java b/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/StealIfEmptyStrategy.java deleted file mode 100644 index adc15630168a00bd37c2101da6d8f1a4731ba5d1..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/concurrent/steal/StealIfEmptyStrategy.java +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.concurrent.steal; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StealIfEmptyStrategy<T> implements IStealStrategy<T> { - - public <S extends IStage> T steal(final IInputPort<S, T> inputPort, final Collection<ConcurrentWorkStealingPipe<T>> pipesToStealFrom) { - for (final ConcurrentWorkStealingPipe<T> pipe : pipesToStealFrom) { - final T stolenElement = pipe.steal(); - if (stolenElement != null) { - return stolenElement; - } - } - // BETTER improve stealing efficiency by stealing multiple elements at once - return null; // do not expose internal impl details (here: CircularWorkStealingDeque); instead return null - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractFilter.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractFilter.java deleted file mode 100644 index 27b78d51550c025e3e8b50c1a1a0ab5db2d8c162..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractFilter.java +++ /dev/null @@ -1,285 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.concurrent.workstealing.exception.DequePopException; - -/** - * - * @author Christian Wulf - * - * @since 1.10 - * - * @param <S> - * the extending stage - * - */ -public abstract class AbstractFilter<S extends IStage> extends AbstractStage implements ISink<S>, ISource { - - /** - * @author Christian Wulf - * - * @since 1.10 - */ - public enum StageState { - UNINITIALIZED, PIPELINE_STARTED, PIPELINE_STOPPED - } - - /** - * Indicates whether this stage has (already) been initialized.<br> - * <i>This attribute prevents this stage to be initialized more than once.</i> - */ - private StageState state = StageState.UNINITIALIZED; - - private int depth = IStage.DEPTH_NOT_SET; - private int schedulingIndex; - private boolean schedulable = true; - - private final List<IInputPort<S, ?>> inputPorts = new ArrayList<IInputPort<S, ?>>(); - private final List<IInputPort<S, ?>> readOnlyInputPorts = Collections.unmodifiableList(this.inputPorts); - - private final List<IOutputPort<S, ?>> outputPorts = new ArrayList<IOutputPort<S, ?>>(); - private final List<IOutputPort<S, ?>> readOnlyOutputPorts = Collections.unmodifiableList(this.outputPorts); - - private Context<S> context; - - private final IPipeCommand closeCommand = new IPipeCommand() { - @Override - public void execute(final IPipe<?> pipe) throws Exception { - pipe.close(); - } - }; - - private final IPipeCommand pipelineStartsCommand = new IPipeCommand() { - @Override - public void execute(final IPipe<?> pipe) throws Exception { - pipe.notifyPipelineStarts(); - } - }; - - /** - * 0=in-memory, x>0=disk0, disk1, display0, display1, socket0, socket1 etc. - */ - private int accessesDeviceId = 0; - - @Override - public int getAccessesDeviceId() { - return this.accessesDeviceId; - } - - @Override - public void setAccessesDeviceId(final int accessesDeviceId) { - this.accessesDeviceId = accessesDeviceId; - } - - // BETTER return a limited context that allows "read" only - @Override - public Context<S> getContext() { - return this.context; - } - - /** - * @since 1.10 - */ - @Override - public final boolean execute() { - boolean success = false; - try { - success = this.execute(this.context); - if (success) { // deprecated boolean return value - this.context.commit(); - } else { - this.context.rollback(); - } - } catch (final DequePopException e) { - this.context.rollback(); - } catch (final Exception e) { - this.logger.error("Error in stage execution", e); - throw new IllegalStateException(e); - } - return success; - } - - protected abstract boolean execute(Context<S> context); - - @Override - public final void notifyPipelineStarts() throws Exception { - if (this.state == StageState.UNINITIALIZED) { - this.state = StageState.PIPELINE_STARTED; - this.onPipelineStarts(); - this.notifyOutputPipes(this.pipelineStartsCommand); - } - } - - /** - * This method is called exactly once iff the pipeline is started. - * - * @throws Exception - * @since 1.10 - */ - public void onPipelineStarts() throws Exception { - this.context = new Context<S>(this, this.readOnlyInputPorts); - } - - /** - * @since 1.10 - */ - @Override - public void notifyOutputPipes(final IPipeCommand pipeCommand) throws Exception { - for (final IOutputPort<S, ?> outputPort : this.readOnlyOutputPorts) { - final IPipe<?> associatedPipe = outputPort.getAssociatedPipe(); - if (associatedPipe != null) { - pipeCommand.execute(associatedPipe); - } // else: ignore unconnected port - } - } - - @Override - public final void notifyPipelineStops() { - if (this.state != StageState.PIPELINE_STOPPED) { - this.state = StageState.PIPELINE_STOPPED; - this.onPipelineStops(); - } - } - - /** - * This method is called exactly once iff the pipeline is stopped. - * - * @since 1.10 - */ - public void onPipelineStops() { - // default empty implementation - } - - /** - * @since 1.10 - */ - @Override - public void fireSignalClosingToAllOutputPorts() { - try { - this.notifyOutputPipes(this.closeCommand); - } catch (final Exception e) { - throw new IllegalStateException("may not happen", e); - } - } - - @Override - public String toString() { - final String s = super.toString(); - return "{" + s + ": " + "numPushedElements=" + this.context + "}"; - // return s; - } - - /** - * @since 1.10 - * @return a new input port that accepts elements of the particular type that is specified in the variable declaration. - */ - protected <T> IInputPort<S, T> createInputPort() { - @SuppressWarnings("unchecked") - final InputPortImpl<S, T> inputPort = new InputPortImpl<S, T>((S) this); - inputPort.setIndex(this.inputPorts.size()); - this.inputPorts.add(inputPort); - return inputPort; - } - - /** - * @since 1.10 - * @return a new output port that accepts elements of the particular type that is specified in the variable declaration. - */ - protected <T> IOutputPort<S, T> createOutputPort() { - @SuppressWarnings("unchecked") - final OutputPortImpl<S, T> outputPort = new OutputPortImpl<S, T>((S) this); - outputPort.setIndex(this.outputPorts.size()); - this.outputPorts.add(outputPort); - return outputPort; - } - - /** - * @since 1.10 - */ - @Override - @SuppressWarnings("unchecked") - public List<IInputPort<S, ?>> getInputPorts() { - return this.readOnlyInputPorts; - } - - /** - * @since 1.10 - */ - @Override - @SuppressWarnings("unchecked") - public List<IOutputPort<S, ?>> getOutputPorts() { - return this.readOnlyOutputPorts; - } - - @Override - public Collection<? extends IStage> getAllOutputStages() { - final Collection<IStage> outputStages = new LinkedList<IStage>(); - for (final IOutputPort<S, ?> outputPort : this.readOnlyOutputPorts) { - final IPipe<?> associatedPipe = outputPort.getAssociatedPipe(); - if (associatedPipe != null) { - outputStages.add(associatedPipe.getTargetPort().getOwningStage()); - } - } - return outputStages; - } - - @Override - public IInputPort<?, ?> getInputPortByIndex(final int index) { - return this.readOnlyInputPorts.get(index); - } - - @Override - public IOutputPort<?, ?> getOutputPortByIndex(final int index) { - return this.readOnlyOutputPorts.get(index); - } - - @Override - public int getDepth() { - return this.depth; - } - - @Override - public void setDepth(final int depth) { - this.depth = depth; - } - - @Override - public int getSchedulingIndex() { - return this.schedulingIndex; - } - - @Override - public void setSchedulingIndex(final int schedulingIndex) { - this.schedulingIndex = schedulingIndex; - } - - @Override - public boolean isSchedulable() { - return this.schedulable; - } - - public void setSchedulable(final boolean schedulable) { - this.schedulable = schedulable; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractMultiPort.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractMultiPort.java deleted file mode 100644 index 06930008566439131101bec09c2add9df89269d1..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractMultiPort.java +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -abstract class AbstractMultiPort<S extends IStage, T> { - - private final Set<IPipe<T>> associatedPipes = new HashSet<IPipe<T>>(); - private final Set<IPipe<T>> readOnlyAssociatedPipes = Collections.unmodifiableSet(this.associatedPipes); - - private S owningStage; - - public void addAssociatedPipe(final IPipe<T> associatedPipe) { - this.associatedPipes.add(associatedPipe); - } - - public Set<IPipe<T>> getAssociatedPipes() { - return this.readOnlyAssociatedPipes; - } - - public S getOwningStage() { - return this.owningStage; - } - - public void setOwningStage(final S owningStage) { - this.owningStage = owningStage; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPipe.java deleted file mode 100644 index 262e23e6e001d0965b9ef657c8633d60378f6ac2..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPipe.java +++ /dev/null @@ -1,126 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - * - * @param <T> - * The type of the pipe - * @param <P> - * the extending pipe - */ -public abstract class AbstractPipe<T> implements IPipe<T> { - - public static final Object EMPTY_OBJECT = null; - - /** - * @author Christian Wulf - * - * @since 1.10 - */ - public enum PipeState { - UNINITIALIZED, PIPELINE_STARTED, PIPELINE_STOPPED - } - - private PipeState state = PipeState.UNINITIALIZED; - - private IOutputPort<?, ? extends T> sourcePort; - private IInputPort<?, T> targetPort; - - @Override - public IOutputPort<?, ? extends T> getSourcePort() { - return this.sourcePort; - } - - @Override - public IInputPort<?, T> getTargetPort() { - return this.targetPort; - } - - @Override - public <S extends ISource, A extends T> void setSourcePort(final IOutputPort<S, A> sourcePort) { - sourcePort.setAssociatedPipe(this); - this.sourcePort = sourcePort; - } - - @Override - public <S extends ISink<S>, A extends T> void setTargetPort(final IInputPort<S, T> targetPort) { - targetPort.setAssociatedPipe(this); - this.targetPort = targetPort; - } - - // BETTER remove if it does not add any new functionality - protected abstract void putInternal(T token); - - @Override - public void put(final T token) { - this.putInternal(token); - } - - // BETTER remove if it does not add any new functionality - protected abstract T tryTakeInternal(); - - @Override - public final T tryTake() { - return this.tryTakeInternal(); - } - - @Override - public final void notifyPipelineStarts() throws Exception { - if (this.state == PipeState.UNINITIALIZED) { - this.state = PipeState.PIPELINE_STARTED; - this.onPipelineStarts(); - this.getTargetPort().getOwningStage().notifyPipelineStarts(); - } - } - - /** - * This method is called exactly once iff the pipeline is started. - * - * @since 1.10 - */ - public void onPipelineStarts() { - // empty default implementation - } - - @Override - public final void notifyPipelineStops() { - if (this.state != PipeState.PIPELINE_STOPPED) { - this.state = PipeState.PIPELINE_STOPPED; - this.onPipelineStops(); - this.getTargetPort().getOwningStage().notifyPipelineStops(); - } - } - - /** - * This method is called exactly once iff the pipeline is stopped. - * - * @since 1.10 - */ - public void onPipelineStops() { - // empty default implementation - } - - @Override - public void close() { - this.targetPort.close(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPort.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPort.java deleted file mode 100644 index 834e3b201250497d0826873ecdc498b079706b2f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractPort.java +++ /dev/null @@ -1,37 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -abstract class AbstractPort<S extends IStage, T> implements IPort<S, T> { - - private IPipe<? super T> associatedPipe; - private S owningStage; - private int index; - - public <A extends T> void setAssociatedPipe(final IPipe<? super T> associatedPipe) { - this.associatedPipe = associatedPipe; - } - - public IPipe<? super T> getAssociatedPipe() { - return this.associatedPipe; - } - - public S getOwningStage() { - return this.owningStage; - } - - public void setOwningStage(final S owningStage) { - this.owningStage = owningStage; - } - - public int getIndex() { - return this.index; - } - - void setIndex(final int index) { - this.index = index; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractStage.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractStage.java deleted file mode 100644 index 9fb4c027107dd54a1b0d0cda162e48a8458b173e..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/AbstractStage.java +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.UUID; - -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public abstract class AbstractStage implements IStage { - - private final String id; - /** - * A unique logger instance per stage instance - */ - protected Log logger; - private IPipeline owningPipeline; - - private Thread owningThread; - - public AbstractStage() { - this.id = UUID.randomUUID().toString(); // the id should only be represented by a UUID, not additionally by the class name - this.logger = LogFactory.getLog(this.id); - } - - public String getId() { - return this.id; - } - - public IPipeline getOwningPipeline() { - return this.owningPipeline; - } - - public void setOwningPipeline(final IPipeline owningPipeline) { - this.owningPipeline = owningPipeline; - } - - @Override - public Thread getOwningThread() { - return this.owningThread; - } - - public void setOwningThread(final Thread owningThread) { - this.owningThread = owningThread; - } - - @Override - public String toString() { - // return "{" + "class=" + this.getClass().getSimpleName() + ", id=" + this.id + "}"; - return this.getClass().getSimpleName() + "(" + Thread.currentThread() + ")"; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/CompositeFilter.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/CompositeFilter.java deleted file mode 100644 index 262d124a249e1ccaaffe5128ef7fc927fa61ccdf..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/CompositeFilter.java +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public abstract class CompositeFilter implements IBaseStage { - - protected final List<IBaseStage> schedulableStages = new ArrayList<IBaseStage>(); - - private final Map<IOutputPort<?, ?>, IInputPort<?, ?>> connections = new HashMap<IOutputPort<?, ?>, IInputPort<?, ?>>(); - - public List<IBaseStage> getSchedulableStages() { - return this.schedulableStages; - } - - protected <T, S1 extends ISink<S1>, S0 extends ISource> void connectWithPipe(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - this.connections.put(sourcePort, targetPort); - } - - public Map<IOutputPort<?, ?>, IInputPort<?, ?>> getConnections() { - return this.connections; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/Context.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/Context.java deleted file mode 100644 index 3935b16205739864f08400668b3666ef4faa7439..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/Context.java +++ /dev/null @@ -1,187 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class Context<S extends IStage> { - - /** - * @author Christian Wulf - * - * @since 1.10 - */ - private static class InputPortContainer { - public final List<Object> takenElements = new ArrayList<Object>(); - public IPipe<Object> pipe; - - public InputPortContainer() {} - } - - private final InputPortContainer[] inputPortContainers; - private final IOutputPort<S, ?>[] outputPorts; - - // statistics values - private long numPushedElements = 0; - private long numTakenElements = 0; - - private long numTakenElementsInCurrentTransaction = 0; - - @SuppressWarnings("unchecked") - public Context(final IStage owningStage, final List<IInputPort<S, ?>> allTargetPorts) { - this.inputPortContainers = this.createInputPortLists(owningStage.getInputPorts()); - this.outputPorts = new IOutputPort[owningStage.getOutputPorts().size()]; - } - - @SuppressWarnings("unchecked") - private InputPortContainer[] createInputPortLists(final List<IInputPort<IStage, ?>> inputPorts) { - final InputPortContainer[] inputPortContainers = new InputPortContainer[inputPorts.size()]; - for (int i = 0; i < inputPorts.size(); i++) { - inputPortContainers[i] = new InputPortContainer(); - inputPortContainers[i].pipe = (IPipe<Object>) inputPorts.get(i).getAssociatedPipe(); - } - return inputPortContainers; - } - - /** - * @since 1.10 - */ - public <T> void put(final IOutputPort<S, T> port, final T object) { - final IPipe<? super T> associatedPipe = port.getAssociatedPipe(); - if (associatedPipe == null) { - return; // ignore unconnected port - // BETTER return a NullObject rather than checking for null - } - associatedPipe.put(object); - - this.outputPorts[port.getIndex()] = port; - this.numPushedElements++; - } - - /** - * - * @param inputPort - * @return - * @since 1.10 - */ - public <T> T tryTake(final IInputPort<S, T> inputPort) { - final IPipe<? super T> associatedPipe = inputPort.getAssociatedPipe(); - final T token = associatedPipe.tryTake(); - if (token != null) { - this.logTransaction(inputPort, token); - } - return token; - } - - /** - * - * @param inputPort - * @return - * @since 1.10 - */ - public <T> T take(final IInputPort<S, T> inputPort) { - final IPipe<? super T> associatedPipe = inputPort.getAssociatedPipe(); - final T token = associatedPipe.take(); - if (token != null) { - this.logTransaction(inputPort, token); - } - return token; - } - - private final <T> void logTransaction(final IInputPort<S, T> inputPort, final T token) { - // final InputPortContainer inputPortContainer = this.inputPortContainers[inputPort.getIndex()]; - // inputPortContainer.takenElements.add(token); - - this.numTakenElementsInCurrentTransaction++; - } - - /** - * - * @param inputPort - * @return - * - * @since 1.10 - */ - public <T> T read(final IInputPort<S, T> inputPort) { - final IPipe<? super T> associatedPipe = inputPort.getAssociatedPipe(); - return associatedPipe.read(); - } - - void commit() { - // for (final List<Object> takenElements : this.pipesTakenFrom.values()) { - for (final InputPortContainer inputPortContainer : this.inputPortContainers) { - // inputPortContainer.takenElements.clear(); - - IReservablePipe<Object> reservablePipe = (IReservablePipe<Object>) inputPortContainer.pipe; - reservablePipe.commit(); - } - - this.numTakenElements += this.numTakenElementsInCurrentTransaction; - this.numTakenElementsInCurrentTransaction = 0; - - for (final IOutputPort<S, ?> outputPort : this.outputPorts) { - if (outputPort != null) { - @SuppressWarnings("unchecked") - IReservablePipe<Object> reservablePipe = (IReservablePipe<Object>) outputPort.getAssociatedPipe(); - reservablePipe.commit(); - } - } - } - - void rollback() { - for (final InputPortContainer inputPortContainer : this.inputPortContainers) { - // for (int k = inputPortContainer.takenElements.size() - 1; k >= 0; k--) { - // final Object element = inputPortContainer.takenElements.get(k); - // inputPortContainer.pipe.put(element); - // } - IReservablePipe<Object> reservablePipe = (IReservablePipe<Object>) inputPortContainer.pipe; - reservablePipe.rollback(); - } - - for (final IOutputPort<S, ?> outputPort : this.outputPorts) { - if (outputPort != null) { - @SuppressWarnings("unchecked") - IReservablePipe<Object> reservablePipe = (IReservablePipe<Object>) outputPort.getAssociatedPipe(); - reservablePipe.rollback(); - } - } - } - - @Override - public String toString() { - return "{" + "numTakenElements=" + this.numTakenElements + ", " + "numPushedElements=" + this.numPushedElements + "}"; - } - - /** - * @return <code>true</code> iff all input ports are empty, otherwise <code>false</code>. - */ - public boolean inputPortsAreEmpty() { - for (final InputPortContainer inputPortContainer : this.inputPortContainers) { - if (!inputPortContainer.pipe.isEmpty()) { - return false; - } - } - return true; - } - - /** - * @since 1.10 - */ - public void clearSucessors() { - for (int i = 0; i < this.outputPorts.length; i++) { - this.outputPorts[i] = null; - } - } - - /** - * @return - * @since 1.10 - */ - public IOutputPort<S, ?>[] getOutputPorts() { - return this.outputPorts; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/Description.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/Description.java deleted file mode 100644 index ade2e1668ade35c471652c4e4c520d75df1c20d3..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/Description.java +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE, ElementType.FIELD }) -public @interface Description { - - String value(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IBaseStage.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IBaseStage.java deleted file mode 100644 index 965793c48fcd1807b66fbd973196107763a71cb1..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IBaseStage.java +++ /dev/null @@ -1,25 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IBaseStage { - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IInputPort.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IInputPort.java deleted file mode 100644 index 254d262828cd93182cbaf140b51fb8c92894a44f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IInputPort.java +++ /dev/null @@ -1,40 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -/** - * - * @author Christian Wulf - * - * @param <S> - * the stage, this port belongs to<br> - * <i>(used for ensuring type safety)</i> - * @param <T> - */ -public interface IInputPort<S extends IStage, T> extends IPort<S, T> { - - /** - * @since 1.10 - */ - public enum PortState { - OPENED, CLOSED - } - - /** - * @since 1.10 - */ - public abstract PortState getState(); - - /** - * @since 1.10 - */ - public abstract void setState(final PortState state); - - /** - * @since 1.10 - */ - public abstract void setPortListener(final IPortListener portListener); - - /** - * @since 1.10 - */ - public void close(); -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IOutputPort.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IOutputPort.java deleted file mode 100644 index c06718279f58b63e06fba55d413094dcdf2fde18..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IOutputPort.java +++ /dev/null @@ -1,14 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -/** - * - * @author Christian Wulf - * - * @param <S> - * the stage, this port belongs to<br> - * <i>(used for ensuring type safety)</i> - * @param <T> - */ -public interface IOutputPort<S extends IStage, T> extends IPort<S, T> { - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipe.java deleted file mode 100644 index a14ba0c1fa2fdb91af2ec139da2008f6b6010bd1..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipe.java +++ /dev/null @@ -1,123 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.List; - -import teetime.util.concurrent.workstealing.exception.DequePopException; - -/** - * - * @author Christian Wulf - * - * @since 1.10 - * - * @param <T> - * the type of elements this pipe may contain - * @param <P> - */ -public interface IPipe<T> { - - /** - * @since 1.10 - */ - void put(T element); - - /** - * @since 1.10 - */ - void putMultiple(List<T> elements); - - // Let this uncommented for documentation purpose:<br> - // Since the concurrent execution does not base on locks, it is difficult to define a blocking take. Since there is no definition of blocking in the sequential - // execution, we do not define a blocking take in this interface - // /** - // * @since 1.10 - // */ - // @Deprecated - // T take(); - - /** - * @return and removes the next element if the pipe is not empty, otherwise <code>null</code> - * - * @since 1.10 - */ - <A extends T> A tryTake(); - - /** - * - * @return and removes the next element if the pipe is not empty, otherwise it throws a <code>DequePopException</code> - * - * @throws DequePopException - */ - <A extends T> A take(); - - /** - * @since 1.10 - * @return but does not removes the next element if the pipe is not empty, otherwise <code>null</code> - */ - <A extends T> A read(); - - /** - * @since 1.10 - */ - List<?> tryTakeMultiple(int numElementsToTake); - - /** - * <i>Attention: Checking for emptiness is rarely appropriate, since the state from EMPTY to NON-EMPTY can change between check and access (stale state).</i> - * - * @return <code>true</code> if this pipe is empty in this special point in time, otherwise <code>false</code>. - */ - boolean isEmpty(); - - /** - * @since 1.10 - */ - <S extends ISource, A extends T> void setSourcePort(final IOutputPort<S, A> sourcePort); - - /** - * @since 1.10 - */ - <S extends ISink<S>, A extends T> void setTargetPort(final IInputPort<S, T> targetPort); - - /** - * @since 1.10 - */ - IOutputPort<?, ? extends T> getSourcePort(); - - /** - * @since 1.10 - */ - IInputPort<?, T> getTargetPort(); - - /** - * @throws Exception - * @since 1.10 - */ - void notifyPipelineStarts() throws Exception; - - /** - * @since 1.10 - */ - void notifyPipelineStops(); - - /** - * @since 1.10 - */ - void close(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeCommand.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeCommand.java deleted file mode 100644 index e6eb0bc7d3d47038c03d270a38b128c12440c0a4..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeCommand.java +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IPipeCommand { - - void execute(IPipe<?> pipe) throws Exception; -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeline.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeline.java deleted file mode 100644 index 0b0d86b6d26fe14dc382d3242bbf8cd9b05e9b66..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPipeline.java +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.List; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IPipeline { - - List<? extends IStage> getStages(); - - List<? extends IStage> getStartStages(); - - void fireStartNotification() throws Exception; - - void fireStopNotification(); -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPort.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IPort.java deleted file mode 100644 index 0e6432ed827ee35c8f32e04c9dfde0495bbe6c6f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPort.java +++ /dev/null @@ -1,22 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -/** - * - * @author Christian Wulf - * - * @since 1.10 - * - * @param <T> - * the type of elements this port accepts - */ -interface IPort<S extends IStage, T> { - - IPipe<? super T> getAssociatedPipe(); - - <A extends T> void setAssociatedPipe(final IPipe<? super T> associatedPipe); - - S getOwningStage(); - - int getIndex(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPortListener.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IPortListener.java deleted file mode 100644 index 23e66be6c1934b31bb7ae429043118637c255d5d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IPortListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IPortListener { - - void onPortIsClosed(IInputPort<?, ?> inputPort); -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IReservablePipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IReservablePipe.java deleted file mode 100644 index 3c1ef86e60f77c5e53d0c5fc675591c6b8e40429..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IReservablePipe.java +++ /dev/null @@ -1,10 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -public interface IReservablePipe<T> extends IPipe<T> { - - // void reserve(T element); - - void commit(); - - void rollback(); -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/ISink.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/ISink.java deleted file mode 100644 index 9e33b6bcdfd4a18d76a1757d96c4811de02ec869..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/ISink.java +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * - * @author Christian Wulf - * - * @since 1.10 - * - * @param <S> - */ -public interface ISink<S extends IStage> extends IStage { - - // BETTER remove the type parameter -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/ISource.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/ISource.java deleted file mode 100644 index 75e3ca48b4f51f736eae099ef01b7087cf6bd87c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/ISource.java +++ /dev/null @@ -1,27 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -/** - * @author Christian Wulf - * - * @since 1.10 - * - */ -public interface ISource extends IStage { - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/IStage.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/IStage.java deleted file mode 100644 index bcadf66d90518e00e75c0e8836b51c6546a5a2c4..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/IStage.java +++ /dev/null @@ -1,165 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.Collection; -import java.util.List; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public interface IStage extends IBaseStage { - - public final static int DEPTH_NOT_SET = -1; - - /** - * @since 1.10 - */ - public String getId(); - - /** - * @return <code>true</code> if the execution took enough tokens from the input ports so that the stage made progress due to this execution, <code>false</code> - * otherwise. The definition of <i>progress</i> depends on the semantics of the particular stage. - * - * <p> - * Example usage: - * </p> - * - * <pre> - * <code> - * boolean execute() { - * final Tuple token = this.tryTake(FILE_WORDCOUNT_TUPLE); - * if (token == null) { - * return false; - * } - * ... - * return true; - * } - * </code> - * </pre> - * - * @since 1.10 - */ - boolean execute(); - - // Let the method uncommented for documentation purpose:<br> - // Since the execution can dependent on the state of one, a subset, or all input queues,<br> - // an overloaded version with one input port is useless. - // void execute(InputPort inputPort); - // - // - // Let the method uncommented for documentation purpose:<br> - // Since the execution can dependent on one, a subset, or all input queues,<br> - // an overloaded version with a task bundle of one single input port is useless. - // void execute(TaskBundle taskBundle); - - /** - * @since 1.10 - */ - void fireSignalClosingToAllOutputPorts(); - - /** - * @since 1.10 - */ - void notifyPipelineStarts() throws Exception; - - /** - * @since 1.10 - */ - void notifyPipelineStops(); - - /** - * <i>Hint: Used by the scheduler</i> - * - * @since 1.10 - */ - Context<?> getContext(); - - /** - * @since 1.10 - */ - IOutputPort<?, ?> getOutputPortByIndex(int index); - - /** - * @since 1.10 - */ - IInputPort<?, ?> getInputPortByIndex(int index); - - /** - * @since 1.10 - */ - int getAccessesDeviceId(); - - /** - * @since 1.10 - */ - void setAccessesDeviceId(final int accessesDeviceId); - - /** - * <i>Hint: Only needed by stage schedulers.</i> - * - * @return - */ - public Collection<? extends IStage> getAllOutputStages(); - - /** - * @since 1.10 - */ - public <S extends IStage> List<IInputPort<S, ?>> getInputPorts(); - - /** - * @since 1.10 - */ - public <S extends IStage> List<IOutputPort<S, ?>> getOutputPorts(); - - Thread getOwningThread(); - - void setOwningThread(Thread owningThread); - - /** - * @since 1.10 - */ - void notifyOutputPipes(IPipeCommand pipeCommand) throws Exception; - - /** - * @since 1.10 - */ - public int getDepth(); - - /** - * @since 1.10 - */ - public void setDepth(int depth); - - /** - * @since 1.10 - */ - public int getSchedulingIndex(); - - /** - * @since 1.10 - */ - public void setSchedulingIndex(int schedulingIndex); - - /** - * @since 1.10 - */ - public boolean isSchedulable(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/InputPortImpl.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/InputPortImpl.java deleted file mode 100644 index 2a61afff01235c415f2f57e89b48bba878e13c6a..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/InputPortImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -class InputPortImpl<S extends IStage, T> extends AbstractPort<S, T> implements IInputPort<S, T> { - - private volatile PortState state = PortState.OPENED; - - private IPortListener portListener; - - public InputPortImpl(final S owningStage) { - this.setOwningStage(owningStage); - } - - @Override - public void setState(final PortState state) { - this.state = state; - } - - @Override - public PortState getState() { - return this.state; - } - - @Override - public void setPortListener(final IPortListener portListener) { - this.portListener = portListener; - } - - @Override - public void close() { - if (this.portListener == null) { - throw new NullPointerException("stage: "+this.getOwningStage().getClass().getName()+", port="+this.getIndex()); - } - this.portListener.onPortIsClosed(this); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/OutputPortImpl.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/OutputPortImpl.java deleted file mode 100644 index 946b2ec300dbb1011c92a6550de5fcc4ccdaa781..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/OutputPortImpl.java +++ /dev/null @@ -1,10 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - - -public class OutputPortImpl<S extends IStage, T> extends AbstractPort<S, T> implements IOutputPort<S, T> { - - public OutputPortImpl(final S owningStage) { - this.setOwningStage(owningStage); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/Pipeline.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/Pipeline.java deleted file mode 100644 index 5526b9b987cc49fe832d56bc8cca245b24abadbd..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/Pipeline.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.core; - -import java.util.List; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class Pipeline implements IPipeline { - - private List<? extends IStage> startStages; - private List<IStage> stages; - - public List<? extends IStage> getStartStages() { - return this.startStages; - } - - public List<IStage> getStages() { - return this.stages; - } - - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - - public void setStartStages(final List<? extends IStage> startStages) { - this.startStages = startStages; - } - - public void setStages(final List<IStage> stages) { - this.stages = stages; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/core/ReservableContext.java b/src/main/java/teetime/variant/explicitScheduling/framework/core/ReservableContext.java deleted file mode 100644 index 37b8f5270a7cdf42eff953f8a544a4fcbb924fba..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/core/ReservableContext.java +++ /dev/null @@ -1,5 +0,0 @@ -package teetime.variant.explicitScheduling.framework.core; - -public class ReservableContext { - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/NextStageScheduler.java b/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/NextStageScheduler.java deleted file mode 100644 index becf818087350cbaec1f42c69e562603ad527f15..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/NextStageScheduler.java +++ /dev/null @@ -1,106 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.scheduling; - -import java.util.LinkedHashSet; -import java.util.Set; - -import teetime.variant.explicitScheduling.framework.concurrent.IStageScheduler; -import teetime.variant.explicitScheduling.framework.concurrent.IStageWorkList; -import teetime.variant.explicitScheduling.framework.concurrent.StageWorkArrayList; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public final class NextStageScheduler implements IStageScheduler { - - private final Set<IStage> highestPrioritizedEnabledStages = new LinkedHashSet<IStage>(); - private final IStageWorkList workList; - private final StageStateManager stageStateManager; - - public NextStageScheduler(final IPipeline pipeline, final int accessesDeviceId, final StageStateManager stageStateManager) { - this.stageStateManager = stageStateManager; - // this.workList = new StageWorkList(accessesDeviceId, pipeline.getStages().size()); - this.workList = new StageWorkArrayList(pipeline, accessesDeviceId); // faster implementation - - this.highestPrioritizedEnabledStages.addAll(pipeline.getStartStages()); - - this.workList.pushAll(this.highestPrioritizedEnabledStages); - // System.out.println("Initial work list: " + this.workList); - // this.workList.addAll(pipeline.getStages()); - } - - @Override - public final IStage get() { - return this.workList.read(); - } - - @Override - public final boolean isAnyStageActive() { - return !this.workList.isEmpty(); - } - - @Override - public final void disable(final IStage stage) { - this.stageStateManager.disable(stage); - - if (this.highestPrioritizedEnabledStages.contains(stage)) { - this.highestPrioritizedEnabledStages.remove(stage); - for (final IStage outputStage : stage.getAllOutputStages()) { - if (this.stageStateManager.isStageEnabled(outputStage)) { - this.highestPrioritizedEnabledStages.add(outputStage); - } - } - } - - // System.out.println("highestPrioritizedEnabledStages: "+this.highestPrioritizedEnabledStages); - stage.fireSignalClosingToAllOutputPorts(); - } - - @Override - public final void determineNextStage(final IStage stage, final boolean executedSuccessfully) { - // final Collection<? extends IStage> outputStages = stage.getContext().getOutputStages(); - final IOutputPort<?, ?>[] outputPorts = stage.getContext().getOutputPorts(); - if (outputPorts.length > 0) { - final boolean inputPortsAreEmpty = stage.getContext().inputPortsAreEmpty(); - if (inputPortsAreEmpty) { - this.workList.pop(); - } - - // TODO consider to not add the stage again if it has a cyclic pipe - // TODO or prioritize non-self stages - // while (outputStages.remove(stage)) { - // } - - this.workList.pushAll(outputPorts); - - stage.getContext().clearSucessors(); - } else { - this.workList.pop(); - } - - if (this.workList.isEmpty()) { - this.workList.pushAll(this.highestPrioritizedEnabledStages); - } - - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateContainer.java b/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateContainer.java deleted file mode 100644 index fdc8241c5fe8877007ea02995dd694028a2b3a76..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateContainer.java +++ /dev/null @@ -1,25 +0,0 @@ -package teetime.variant.explicitScheduling.framework.scheduling; - -import teetime.variant.explicitScheduling.framework.core.IStage; - -public abstract class StageStateContainer { - - public static enum StageState { - ENABLED, ALL_INPUT_PORTS_CLOSED, DISABLED - } - - protected final IStage stage; - protected volatile StageState stageState; - - public StageStateContainer(final IStage stage) { - this.stage = stage; - this.stageState = stage.getInputPorts().size() > 0 ? StageState.ENABLED : StageState.ALL_INPUT_PORTS_CLOSED; -// System.out.println("stage=" + stage + ", stageState=" + this.stageState); - } - - /** - * - * @return the new value - */ - public abstract int decNumOpenedPorts(); -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateManager.java b/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateManager.java deleted file mode 100644 index 04b0d51a19e2173a0f0f62e8946422cc9382f0f2..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/StageStateManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package teetime.variant.explicitScheduling.framework.scheduling; - -import java.util.Arrays; - -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IPipeline; -import teetime.variant.explicitScheduling.framework.core.IPortListener; -import teetime.variant.explicitScheduling.framework.core.IStage; -import teetime.variant.explicitScheduling.framework.scheduling.StageStateContainer.StageState; - -public final class StageStateManager implements IPortListener { - - private final StageStateContainer[] stageStateContainers; - - public StageStateManager(final IPipeline pipeline) { - this.stageStateContainers = this.initStageStateContainers(pipeline); - this.registerAtAllInputPorts(pipeline); - } - - private void registerAtAllInputPorts(final IPipeline pipeline) { - for (IStage stage : pipeline.getStages()) { - for (IInputPort<IStage, ?> inputPort : stage.getInputPorts()) { - inputPort.setPortListener(this); - } - } - } - - private StageStateContainer[] initStageStateContainers(final IPipeline pipeline) { - StageStateContainer[] stageStateContainers = new StageStateContainer[pipeline.getStages().size()]; - for (IStage stage : pipeline.getStages()) { - StageStateContainer stageStateContainer; - if (this.isConnectedWithAnotherThread(stage)) { - stageStateContainer = new SynchronizedStageStateContainer(stage); - } else { - stageStateContainer = new UnsynchronizedStageStateContainer(stage); - } - stageStateContainers[stage.getSchedulingIndex()] = stageStateContainer; - } - return stageStateContainers; - } - - private boolean isConnectedWithAnotherThread(final IStage stage) { - // TODO Auto-generated method stub - return true; - } - - @Override - public void onPortIsClosed(final IInputPort<?, ?> inputPort) { - StageStateContainer stageStateContainer = this.getStageStateContainer(inputPort.getOwningStage()); - - int newNumOpenedPorts = stageStateContainer.decNumOpenedPorts(); - if (newNumOpenedPorts == 0) { - stageStateContainer.stageState = StageState.ALL_INPUT_PORTS_CLOSED; -// System.out.println("Closed stage: " + stageStateContainer.stage); - } else if (newNumOpenedPorts < 0) { - // TODO log warning - // this.logger.warning("Closed port more than once: portIndex=" + inputPort.getIndex() + " for stage " + this); - } - } - - public boolean areAllInputPortsClosed(final IStage stage) { - StageStateContainer stageStateContainer = this.getStageStateContainer(stage); - return stageStateContainer.stageState == StageState.ALL_INPUT_PORTS_CLOSED; - } - - public boolean isStageEnabled(final IStage stage) { - StageStateContainer stageStateContainer = this.getStageStateContainer(stage); - return stageStateContainer.stageState == StageState.ENABLED; - } - - public void disable(final IStage stage) { - StageStateContainer stageStateContainer = this.getStageStateContainer(stage); - stageStateContainer.stageState = StageState.DISABLED; - } - - private StageStateContainer getStageStateContainer(final IStage stage) { - int schedulingIndex = stage.getSchedulingIndex(); - StageStateContainer stageStateContainer = this.stageStateContainers[schedulingIndex]; - if (stageStateContainer == null) { - throw new NullPointerException("No container found for index ="+schedulingIndex+"\n=> stageStateContainers="+Arrays.asList(this.stageStateContainers)); - } - return stageStateContainer; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/SynchronizedStageStateContainer.java b/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/SynchronizedStageStateContainer.java deleted file mode 100644 index 9dd69e3a0140fd531811e5ba1dda799d216ef33f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/SynchronizedStageStateContainer.java +++ /dev/null @@ -1,21 +0,0 @@ -package teetime.variant.explicitScheduling.framework.scheduling; - -import java.util.concurrent.atomic.AtomicInteger; - -import teetime.variant.explicitScheduling.framework.core.IStage; - -public final class SynchronizedStageStateContainer extends StageStateContainer { - - private final AtomicInteger numOpenedPorts = new AtomicInteger(); - - public SynchronizedStageStateContainer(final IStage stage) { - super(stage); - this.numOpenedPorts.set(stage.getInputPorts().size()); - } - - @Override - public int decNumOpenedPorts() { - return this.numOpenedPorts.decrementAndGet(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/UnsynchronizedStageStateContainer.java b/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/UnsynchronizedStageStateContainer.java deleted file mode 100644 index f425d2bab675ab577b5b0ba3fc3e9271365c7aea..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/scheduling/UnsynchronizedStageStateContainer.java +++ /dev/null @@ -1,19 +0,0 @@ -package teetime.variant.explicitScheduling.framework.scheduling; - -import teetime.variant.explicitScheduling.framework.core.IStage; - -public final class UnsynchronizedStageStateContainer extends StageStateContainer { - - private int numOpenedInputPorts; - - public UnsynchronizedStageStateContainer(final IStage stage) { - super(stage); - this.numOpenedInputPorts = stage.getInputPorts().size(); - } - - @Override - public int decNumOpenedPorts() { - return --this.numOpenedInputPorts; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/MethodCallPipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/sequential/MethodCallPipe.java deleted file mode 100644 index 820fb6dc5efd4e2b8546244d394e927c155a92fd..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/MethodCallPipe.java +++ /dev/null @@ -1,105 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.sequential; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.AbstractPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IReservablePipe; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallPipe<T> extends AbstractPipe<T> implements IReservablePipe<T> { - - private T storedToken; - - public MethodCallPipe(final T initialToken) { - this.storedToken = initialToken; - } - - public MethodCallPipe() { - this.storedToken = null; - } - - static public <S0 extends ISource, S1 extends ISink<S1>, T> void connect(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - final MethodCallPipe<T> pipe = new MethodCallPipe<T>(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - @Override - protected void putInternal(final T token) { - this.storedToken = token; - this.getTargetPort().getOwningStage().execute(); - } - - @Override - protected T tryTakeInternal() { - final T temp = this.storedToken; - this.storedToken = null; - return temp; - } - - @Override - public T take() { - return this.tryTake(); - } - - @Override - public T read() { - return this.storedToken; - } - - @Override - public void putMultiple(final List<T> items) { - throw new IllegalStateException("Putting more than one element is not possible. You tried to put " + items.size() + " items."); - } - - @Override - public List<?> tryTakeMultiple(final int numElementsToTake) { - throw new IllegalStateException("Taking more than one element is not possible. You tried to take " + numElementsToTake + " items."); - } - - public void copyAllOtherPipes(final List<MethodCallPipe<T>> pipesOfGroup) { - // is not needed in a synchronous execution - } - - @Override - public boolean isEmpty() { - return this.storedToken == null; - } - - @Override - public void commit() { - // TODO Auto-generated method stub - - } - - @Override - public void rollback() { - // TODO Auto-generated method stub - - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/Pipeline.java.todo b/src/main/java/teetime/variant/explicitScheduling/framework/sequential/Pipeline.java.todo deleted file mode 100644 index 9b95dc1904537338d4f6869054812c209ce15d65..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/Pipeline.java.todo +++ /dev/null @@ -1,190 +0,0 @@ -/*************************************************************************** - * 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 kieker.panalysis.framework.sequential; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import kieker.panalysis.framework.core.AbstractFilter; -import kieker.panalysis.framework.core.IInputPort; -import kieker.panalysis.framework.core.IOutputPort; -import kieker.panalysis.framework.core.IPipe; -import kieker.panalysis.framework.core.ISink; -import kieker.panalysis.framework.core.ISource; -import kieker.panalysis.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - * - * @param <P> - * The type of the pipes - */ -public class Pipeline<P extends IPipe<?>> { - - protected final List<IStage> stages = new LinkedList<IStage>(); - private int freeId = 0; - private AbstractFilter<?>[] startStages; - - private P currentPipe; - private final Map<Integer, List<P>> pipeGroups; - private final Map<IOutputPort<?, ?>, IInputPort<?, ?>> connections = new HashMap<IOutputPort<?, ?>, IInputPort<?, ?>>(); - - /** - * The default constructor.<br> - * <i>Public constructors are available via the static method <code>create(..)</code></i> - * - * @see for example, {@link #create(Map)} - * - * @since 1.10 - */ - private Pipeline() { - this(new HashMap<Integer, List<P>>()); - } - - /** - * @since 1.10 - */ - private Pipeline(final Map<Integer, List<P>> pipeGroups) { - this.pipeGroups = pipeGroups; - } - - /** - * @since 1.10 - */ - // this constructor prevents the programmer from repeating the type argument - public static <P extends IPipe<?>> Pipeline<P> create() { - return new Pipeline<P>(); - } - - /** - * - * @param pipeGroups - * a map where its keys represent the group id and its values represent the list of pipes - * @return - */ - // this constructor prevents the programmer from repeating the type argument - public static <P extends IPipe<?>> Pipeline<P> create(final Map<Integer, List<P>> pipeGroups) { - return new Pipeline<P>(pipeGroups); - } - - /** - * <p> - * Adds the given <code>stage</code> to this pipeline and set a unique identifier. - * </p> - * <p> - * Use this method as indicated in the following example: <blockquote> <code>Distributor distributor = pipeline.addStage(new Distributor())</code> </blockquote> - * </p> - * - * @param stage - * @return - */ - public <S extends IStage> S addStage(final S stage) { - stage.setId(this.freeId++); - stage.setOwningPipeline(this); - this.stages.add(stage); - return stage; - } - - /** - * @since 1.10 - */ - public void start() { - this.fireStartEvent(); - - if (this.startStages.length == 0) { - throw new IllegalStateException("You need to define at least one start stage."); - } else if (this.startStages.length == 1) { - // this.startStages.get(0).execute(); - } else { - // TODO create a single distributor stage as start stage - throw new IllegalStateException("Multiple start stages are not yet supported."); - } - } - - /** - * @since 1.10 - */ - private void fireStartEvent() { - for (final IStage stage : this.stages) { - stage.onPipelineStarts(); - } - } - - /** - * @since 1.10 - */ - public List<IStage> getStages() { - return this.stages; - } - - /** - * @since 1.10 - */ - public Pipeline<P> add(final P pipe) { - this.currentPipe = pipe; - return this; - } - - /** - * @since 1.10 - */ - public <S0 extends ISource, S1 extends ISink<S1>, T> void connect(final IOutputPort<S0, T> sourcePort, final IInputPort<S1, T> targetPort) { - this.connections.put(sourcePort, targetPort); - } - - /** - * @since 1.10 - */ - public void toGroup(final int pipeGroupIdentifier) { - List<P> pipes = this.pipeGroups.get(pipeGroupIdentifier); - if (pipes == null) { - pipes = new LinkedList<P>(); - this.pipeGroups.put(pipeGroupIdentifier, pipes); - } - pipes.add(this.currentPipe); - } - - /** - * @since 1.10 - */ - // BETTER move this method out of the pipeline - public void connectPipeGroups() { - for (final List<P> samePipes : this.pipeGroups.values()) { - for (final P pipe : samePipes) { - pipe.copyAllOtherPipes(samePipes); - } - } - } - - /** - * @since 1.10 - */ - public void setStartStages(final AbstractFilter<?>... startStages) { - this.startStages = startStages; - } - - /** - * @since 1.10 - */ - public AbstractFilter<?>[] getStartStages() { - return this.startStages; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/QueuePipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/sequential/QueuePipe.java deleted file mode 100644 index 1a5178477ef9f5396c6b071bbc703caaf8293349..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/QueuePipe.java +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.sequential; - -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -import teetime.util.concurrent.workstealing.CircularWorkStealingDeque; -import teetime.variant.explicitScheduling.framework.core.AbstractPipe; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IReservablePipe; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class QueuePipe<T> extends AbstractPipe<T> implements IReservablePipe<T> { - - // private final List<T> queue = new ArrayList<T>(10); - private final Queue<T> queue = new LinkedList<T>(); - - // private final List<T> queue = new ReservableArrayList<T>(10); - - // private final ObjectPooledLinkedList<T> queue = new ObjectPooledLinkedList<T>(); - - static public <S0 extends ISource, S1 extends ISink<S1>, T> void connect(final IOutputPort<S0, ? extends T> sourcePort, final IInputPort<S1, T> targetPort) { - final QueuePipe<T> pipe = new QueuePipe<T>(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - @Override - public void putInternal(final T element) { - this.queue.add(element); - // this.queue.push(element); - } - - @Override - public void putMultiple(final List<T> elements) { - this.queue.addAll(elements); - throw new IllegalStateException(); - } - - @Override - public T tryTakeInternal() { - return this.queue.poll(); - // return this.queue.remove(this.queue.size() - 1); - // return this.queue.pop(); - } - - @Override - public T take() { - final T element = this.tryTake(); - if (element == null) { - throw CircularWorkStealingDeque.DEQUE_IS_EMPTY_EXCEPTION; - } - return element; - } - - @Override - public T read() { - return this.queue.peek(); - // return this.queue.get(this.queue.size() - 1); - // return this.queue.read(); - } - - @Override - public List<?> tryTakeMultiple(final int numElementsToTake) { - throw new IllegalStateException("Taking more than one element is not possible. You tried to take " + numElementsToTake + " items."); - } - - @Override - public boolean isEmpty() { - return this.queue.isEmpty(); - // return this.queue.size() == 0; - } - - @Override - public void commit() { - // TODO Auto-generated method stub - - } - - @Override - public void rollback() { - // TODO Auto-generated method stub - - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/ReservableQueuePipe.java b/src/main/java/teetime/variant/explicitScheduling/framework/sequential/ReservableQueuePipe.java deleted file mode 100644 index 3ed9a10d38a30b2e10c7493b7cdf227c225e7268..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/sequential/ReservableQueuePipe.java +++ /dev/null @@ -1,63 +0,0 @@ -package teetime.variant.explicitScheduling.framework.sequential; - -import java.util.List; - -import teetime.util.list.CommittableQueue; -import teetime.util.list.CommittableResizableArrayQueue; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IReservablePipe; -import teetime.variant.explicitScheduling.framework.core.ISink; -import teetime.variant.explicitScheduling.framework.core.ISource; - -public class ReservableQueuePipe<T> extends QueuePipe<T> implements IReservablePipe<T> { - - private final CommittableQueue<T> reservableQueue = new CommittableResizableArrayQueue<T>(EMPTY_OBJECT, 10); - - static public <S0 extends ISource, S1 extends ISink<S1>, T> void connect(final IOutputPort<S0, ? extends T> sourcePort, final IInputPort<S1, T> targetPort) { - final QueuePipe<T> pipe = new ReservableQueuePipe<T>(); - pipe.setSourcePort(sourcePort); - pipe.setTargetPort(targetPort); - } - - @Override - public void commit() { - this.reservableQueue.commit(); - } - - @Override - public void rollback() { - this.reservableQueue.rollback(); - } - - @Override - public void putInternal(final T element) { - this.reservableQueue.addToTailUncommitted(element); - } - - @Override - public T tryTakeInternal() { - return this.reservableQueue.removeFromHeadUncommitted(); - } - - @Override - public T read() { - return this.reservableQueue.getTail(); - } - - @Override - public boolean isEmpty() { - return this.reservableQueue.isEmpty(); - } - - @Override - public void putMultiple(final List<T> elements) { - throw new IllegalStateException(); - } - - @Override - public List<?> tryTakeMultiple(final int numElementsToTake) { - throw new IllegalStateException(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/util/BaseStage2StageExtractor.java b/src/main/java/teetime/variant/explicitScheduling/framework/util/BaseStage2StageExtractor.java deleted file mode 100644 index 5db91639ec236ab5ebe199485011c547a7d9b21a..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/util/BaseStage2StageExtractor.java +++ /dev/null @@ -1,49 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.util; - -import java.util.LinkedList; -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.CompositeFilter; -import teetime.variant.explicitScheduling.framework.core.IBaseStage; -import teetime.variant.explicitScheduling.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class BaseStage2StageExtractor { - - public List<? extends IStage> extract(final IBaseStage baseStage) { - final List<IStage> stages = new LinkedList<IStage>(); - this.extractLocally(baseStage, stages); - return stages; - } - - private void extractLocally(final IBaseStage baseStage, final List<IStage> stages) { - if (baseStage instanceof IStage) { - stages.add((IStage) baseStage); - } else if (baseStage instanceof CompositeFilter) { - final List<IBaseStage> schedulableStages = ((CompositeFilter) baseStage).getSchedulableStages(); - for (final IBaseStage childBaseStage : schedulableStages) { - this.extractLocally(childBaseStage, stages); - } - } - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/framework/util/Cloner.java b/src/main/java/teetime/variant/explicitScheduling/framework/util/Cloner.java deleted file mode 100644 index 2fb8acdd34fa84485edf5a2acac6a4e3fd9cd0c6..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/framework/util/Cloner.java +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.framework.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * A helper class to clone bean like objects with default constructors, getters, and setters. - * - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public class Cloner { - - private Cloner() {} - - /** - * Clones the given object by creating a new instance of the class. The method invokes all getter methods on the original and stores the resulting values in the - * clone by invoking the corresponding setter methods. Properties without setter or getter methods are ignored. The resulting clone is always a new instance, - * hence original != clone holds. It is assumed that the given instance provides a default constructor without any parameters. - * - * @param original - * The original instance to clone. - * - * @return A clone of the given instance. - * - * @throws Exception - * If the given instance does not provide a default constructor, the getters or setters are not accessible, the getters and setters are not - * compatible, or any of the methods threw an exception. - */ - @SuppressWarnings("unchecked") - public static <T> T cloneObject(final T original) throws Exception { - // Comment for 1.7: The three exceptions, thrown by this called method, have the same parent exception since 1.7 - final T clone = (T) original.getClass().newInstance(); - - Cloner.cloneAllProperties(original, clone); - - return clone; - } - - private static <T> void cloneAllProperties(final T original, final T clone) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - final Collection<GetterSetterPair> getterSetterPairs = Cloner.getGetterSetterPairs(original.getClass()); - - for (final GetterSetterPair getterSetterPair : getterSetterPairs) { - final Object value = getterSetterPair.getGetter().invoke(original); - getterSetterPair.getSetter().invoke(clone, value); - } - } - - private static Collection<GetterSetterPair> getGetterSetterPairs(final Class<?> clazz) { - final Collection<GetterSetterPair> properties = new ArrayList<GetterSetterPair>(); - - final Map<String, Method> foundGetters = new HashMap<String, Method>(); - final Map<String, Method> foundSetters = new HashMap<String, Method>(); - - final Method[] methods = clazz.getMethods(); - for (final Method method : methods) { - if (Cloner.isGetter(method)) { - final String propertyName = method.getName().substring(3); - if (foundSetters.containsKey(propertyName)) { - properties.add(new GetterSetterPair(method, foundSetters.remove(propertyName))); - } else { - foundGetters.put(propertyName, method); - } - } else if (Cloner.isSetter(method)) { - final String propertyName = method.getName().substring(3); - if (foundGetters.containsKey(propertyName)) { - properties.add(new GetterSetterPair(foundGetters.remove(propertyName), method)); - } else { - foundSetters.put(propertyName, method); - } - } - } - - return properties; - } - - private static boolean isSetter(final Method method) { - return ((method.getReturnType() == Void.TYPE) && (method.getParameterTypes().length == 1) && (Modifier.isPublic(method.getModifiers())) && method.getName() - .matches("set[A-Z].*")); - } - - private static boolean isGetter(final Method method) { - return ((method.getReturnType() != Void.TYPE) && (method.getParameterTypes().length == 0) && (Modifier.isPublic(method.getModifiers())) && method.getName() - .matches("get[A-Z].*")); - } - - private static class GetterSetterPair { - - private final Method getter; - private final Method setter; - - public GetterSetterPair(final Method getter, final Method setter) { - this.getter = getter; - this.setter = setter; - } - - public Method getGetter() { - return this.getter; - } - - public Method getSetter() { - return this.setter; - } - - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/Cache.java b/src/main/java/teetime/variant/explicitScheduling/stage/Cache.java deleted file mode 100644 index 3b5e9d75f7697984cc4c56e3a63fca5932b8f994..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/Cache.java +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import java.util.LinkedList; -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class Cache<T> extends AbstractFilter<Cache<T>> { - - private static enum OperationMode { - CACHING, SENDING - } - - private OperationMode operationMode = OperationMode.CACHING; - - public final IInputPort<Cache<T>, T> objectInputPort = this.createInputPort(); - public final IInputPort<Cache<T>, Boolean> sendInputPort = this.createInputPort(); - - public final IOutputPort<Cache<T>, T> objectOutputPort = this.createOutputPort(); - - private final List<T> cachedObjects = new LinkedList<T>(); - - @Override - protected boolean execute(final Context<Cache<T>> context) { - if (this.operationMode == OperationMode.CACHING) { - final T object = context.tryTake(this.objectInputPort); - if (object == null) { - final Boolean shouldSend = context.tryTake(this.sendInputPort); - if (shouldSend == null) { - return false; - } else { - this.operationMode = OperationMode.SENDING; - } - } else { - this.cache(object); - } - } else { - final boolean sent = this.send(context); - if (!sent) { - this.operationMode = OperationMode.CACHING; - } - } - - return true; - } - - /** - * @since 1.10 - */ - private boolean send(final Context<Cache<T>> context) { - if (this.cachedObjects.size() > 0) { - final T cachedObject = this.cachedObjects.remove(0); - context.put(this.objectOutputPort, cachedObject); - return true; - } else { - return false; - } - } - - /** - * @since 1.10 - */ - private void cache(final T object) { - this.cachedObjects.add(object); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/CollectorSink.java b/src/main/java/teetime/variant/explicitScheduling/stage/CollectorSink.java deleted file mode 100644 index 2ab57eb30162c41a4ffc525a07dfe2f0bd0f6a19..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/CollectorSink.java +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CollectorSink<T> extends AbstractFilter<CollectorSink<T>> { - - private static final int THRESHOLD = 10000; - - public final IInputPort<CollectorSink<T>, T> objectInputPort = this.createInputPort(); - private Collection<T> objects; - - public CollectorSink(final Collection<T> collection) { - this.objects = collection; - } - - public CollectorSink() { - super(); - } - - @Override - protected boolean execute(final Context<CollectorSink<T>> context) { - final T object = context.tryTake(this.objectInputPort); - if (object == null) { - return false; - } - - this.objects.add(object); - - if ((this.objects.size() % THRESHOLD) == 0) { - System.out.println("size: " + this.objects.size()); - } - - return true; - } - - public Collection<T> getObjects() { - return this.objects; - } - - public void setObjects(final Collection<T> objects) { - this.objects = objects; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/CountingFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/CountingFilter.java deleted file mode 100644 index 4cd0b278d9f1e05508d5de69ca9821902bb096fd..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/CountingFilter.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CountingFilter<T> extends AbstractFilter<CountingFilter<T>> { - - public final IInputPort<CountingFilter<T>, T> INPUT_OBJECT = this.createInputPort(); - public final IInputPort<CountingFilter<T>, Long> CURRENT_COUNT = this.createInputPort(); - - public final IOutputPort<CountingFilter<T>, T> RELAYED_OBJECT = this.createOutputPort(); - public final IOutputPort<CountingFilter<T>, Long> NEW_COUNT = this.createOutputPort(); - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<CountingFilter<T>> context) { - final T inputObject = context.tryTake(this.INPUT_OBJECT); - if (inputObject == null) { - return false; - } - final Long currentCount = context.tryTake(this.CURRENT_COUNT); - if (currentCount == null) { - return false; - } - - context.put(this.RELAYED_OBJECT, inputObject); - // FIXME using a MethodCallPipe leads to a stackoverflow since the value (currentCount+1) is put and taken infinitely - context.put(this.NEW_COUNT, currentCount + 1); // BETTER support pipes with primitive values to improve performance by avoiding auto-boxing - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/FileExtensionFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/FileExtensionFilter.java deleted file mode 100644 index 6e058aa40cfe6c8538b394191a59045bc29e6135..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/FileExtensionFilter.java +++ /dev/null @@ -1,78 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import java.io.File; -import java.util.HashMap; -import java.util.regex.Pattern; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class FileExtensionFilter extends AbstractFilter<FileExtensionFilter> { - - public final IInputPort<FileExtensionFilter, File> fileInputPort = this.createInputPort(); - - public final IOutputPort<FileExtensionFilter, File> unknownFileExtensionOutputPort = this.createOutputPort(); - - private final HashMap<String, IOutputPort<FileExtensionFilter, File>> fileExtensionMap = new HashMap<String, IOutputPort<FileExtensionFilter, File>>(); - - private static final Pattern DOT_PATTERN = Pattern.compile("\\."); - - @Override - protected boolean execute(final Context<FileExtensionFilter> context) { - final File file = context.tryTake(this.fileInputPort); - if (file == null) { - return false; - } - - final String[] filenameParts = DOT_PATTERN.split(file.getName()); - final String fileExtension = filenameParts[filenameParts.length - 1]; - final IOutputPort<FileExtensionFilter, File> outputPort = this.fileExtensionMap.get(fileExtension); - if (outputPort != null) { - context.put(outputPort, file); - } else { - context.put(this.unknownFileExtensionOutputPort, file); - } - - return true; - } - - /** - * - * @param fileExtension - * the file extension (<i>a leading dot is removed automatically)</i> - * @return - */ - public IOutputPort<FileExtensionFilter, File> createOutputPortForFileExtension(String fileExtension) { - if (fileExtension.startsWith(".")) { - fileExtension = fileExtension.substring(1); - } - IOutputPort<FileExtensionFilter, File> outputPort = this.fileExtensionMap.get(fileExtension); - if (outputPort == null) { - outputPort = super.createOutputPort(); - this.fileExtensionMap.put(fileExtension, outputPort); - } - return outputPort; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/InstanceOfFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/InstanceOfFilter.java deleted file mode 100644 index aca2e55ec0beb752bb827b136d34a3d7c5385122..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/InstanceOfFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -package teetime.variant.explicitScheduling.stage; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Jan Waller, Nils Christian Ehmke, Christian Wulf - * - * @since 1.10 - */ -public class InstanceOfFilter<I, O> extends AbstractFilter<InstanceOfFilter<I, O>> { - - public final IInputPort<InstanceOfFilter<I, O>, I> inputPort = this.createInputPort(); - - public final IOutputPort<InstanceOfFilter<I, O>, O> matchingOutputPort = this.createOutputPort(); - public final IOutputPort<InstanceOfFilter<I, O>, I> mismatchingOutputPort = this.createOutputPort(); - - private Class<O> type; - - /** - * @since 1.10 - */ - public InstanceOfFilter(final Class<O> type) { - this.type = type; - } - - @Override - protected boolean execute(final Context<InstanceOfFilter<I, O>> context) { - final I inputObject = context.tryTake(this.inputPort); - if (inputObject == null) { - return false; - } - - if (this.type.isInstance(inputObject)) { - context.put(this.matchingOutputPort, this.type.cast(inputObject)); - } else { - context.put(this.mismatchingOutputPort, inputObject); - } - - return true; - } - - public Class<O> getType() { - return this.type; - } - - public void setType(final Class<O> type) { - this.type = type; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/NoopFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/NoopFilter.java deleted file mode 100644 index 5aebff555f20d684fb464809d35a53e4e78529b5..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/NoopFilter.java +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class NoopFilter<T> extends AbstractFilter<NoopFilter<T>> { - - public final IInputPort<NoopFilter<T>, T> inputPort = this.createInputPort(); - public final IOutputPort<NoopFilter<T>, T> outputPort = this.createOutputPort(); - - @Override - protected boolean execute(final Context<NoopFilter<T>> context) { - final T inputElement = context.tryTake(this.inputPort); - if (inputElement == null) { - return false; - } - - context.put(this.outputPort, inputElement); - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/StartTimestampFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/StartTimestampFilter.java deleted file mode 100644 index 447ca3746b32322a3b1e972796cbce53addd9512..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/StartTimestampFilter.java +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StartTimestampFilter extends AbstractFilter<StartTimestampFilter> { - - public final IInputPort<StartTimestampFilter, TimestampObject> inputPort = this.createInputPort(); - public final IOutputPort<StartTimestampFilter, TimestampObject> outputPort = this.createOutputPort(); - - @Override - protected boolean execute(final Context<StartTimestampFilter> context) { - final TimestampObject inputObject = context.tryTake(this.inputPort); - if (inputObject == null) { - return false; - } - - inputObject.setStartTimestamp(System.nanoTime()); - - context.put(this.outputPort, inputObject); - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/StopTimestampFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/StopTimestampFilter.java deleted file mode 100644 index de80acde66c3bde2be494f888ad46106132c3762..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/StopTimestampFilter.java +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StopTimestampFilter extends AbstractFilter<StopTimestampFilter> { - - public final IInputPort<StopTimestampFilter, TimestampObject> inputPort = this.createInputPort(); - public final IOutputPort<StopTimestampFilter, TimestampObject> outputPort = this.createOutputPort(); - - @Override - protected boolean execute(final Context<StopTimestampFilter> context) { - final TimestampObject inputObject = context.tryTake(this.inputPort); - if (inputObject == null) { - return false; - } - - inputObject.setStopTimestamp(System.nanoTime()); - - context.put(this.outputPort, inputObject); - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/SuperTypeFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/SuperTypeFilter.java deleted file mode 100644 index 6b3b109a0607d48b12a6b49142838d05e13e578c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/SuperTypeFilter.java +++ /dev/null @@ -1,23 +0,0 @@ -package teetime.variant.explicitScheduling.stage; - -import java.util.Collection; - -import teetime.variant.explicitScheduling.stage.predicate.IsSuperTypePredicate; -import teetime.variant.explicitScheduling.stage.predicate.PredicateFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class SuperTypeFilter<T> extends PredicateFilter<T> { - - /** - * @param acceptedClasses - * @since 1.10 - */ - public SuperTypeFilter(final Collection<Class<?>> acceptedClasses) { - super(new IsSuperTypePredicate<T>(acceptedClasses)); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/TypeLoggerFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/TypeLoggerFilter.java deleted file mode 100644 index 2624e5a6c6cd1944a13295b52f18fe788aab748e..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/TypeLoggerFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage; - -import java.io.PrintStream; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Matthias Rohr, Jan Waller, Nils Christian Ehmke, Christian Wulf - * - * @since 1.10 - */ -public class TypeLoggerFilter<T> extends AbstractFilter<TypeLoggerFilter<T>> { - - public final IInputPort<TypeLoggerFilter<T>, T> INPUT_OBJECT = this.createInputPort(); - - public final IOutputPort<TypeLoggerFilter<T>, T> RELAYED_OBJECT = this.createOutputPort(); - - private final PrintStream printStream; - - /** - * @since 1.10 - */ - private TypeLoggerFilter() { - this.printStream = System.out; - } - - /** - * @since 1.10 - */ - public static <T> TypeLoggerFilter<T> create() { - return new TypeLoggerFilter<T>(); - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<TypeLoggerFilter<T>> context) { - final T inputObject = context.tryTake(this.INPUT_OBJECT); - if (inputObject == null) { - return false; - } - - final StringBuilder sb = new StringBuilder(128); - sb.append(super.getId()).append('(').append(inputObject.getClass().getSimpleName()).append(") ").append(inputObject.toString()); - this.printStream.println(sb.toString()); - - context.put(this.RELAYED_OBJECT, inputObject); - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/Clock.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/Clock.java deleted file mode 100644 index d6f7910ab5816ccb71d452d8bc35d7b619cfdfab..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/Clock.java +++ /dev/null @@ -1,79 +0,0 @@ -package teetime.variant.explicitScheduling.stage.basic; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * - * The stage implements a clock that continuously outputs the current time as timestamp. This stage MUST be owned by an own thread since this stage calls <code>Thread.sleep()</code>. - * - * @author Christian Wulf - * - * @since 1.10 - * - */ -public class Clock extends AbstractFilter<Clock> { - - public final IOutputPort<Clock, Long> timestampOutputPort = this.createOutputPort(); - - private boolean initialDelayExceeded = false; - - private long initialDelayInMs; - private long intervalDelayInMs; - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<Clock> context) { - if (!initialDelayExceeded) { - initialDelayExceeded = true; - sleep(initialDelayInMs); - } else { - sleep(intervalDelayInMs); - } - - context.put(timestampOutputPort, getCurrentTimeInNs()); - - return true; - } - - @Override - public void onPipelineStarts() throws Exception { - if (getOwningPipeline().getStages().size() > 1) { - throw new IllegalArgumentException("The clock stage must be the only stage within its owning pipeline since it must be executed by a separate thread."); - } - super.onPipelineStarts(); - } - - private void sleep(final long delayInMs) { - try { - Thread.sleep(delayInMs); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private long getCurrentTimeInNs() { - return System.nanoTime(); - } - - public long getInitialDelayInMs() { - return initialDelayInMs; - } - - public void setInitialDelayInMs(final long initialDelayInMs) { - this.initialDelayInMs = initialDelayInMs; - } - - public long getIntervalDelayInMs() { - return intervalDelayInMs; - } - - public void setIntervalDelayInMs(final long intervalDelayInMs) { - this.intervalDelayInMs = intervalDelayInMs; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/Delay.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/Delay.java deleted file mode 100644 index 22fd17c211125741e4c9513be36f61af3f1cbcbc..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/Delay.java +++ /dev/null @@ -1,32 +0,0 @@ -package teetime.variant.explicitScheduling.stage.basic; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -public class Delay<T> extends AbstractFilter<Delay<T>> { - - public final IInputPort<Delay<T>, Object> signalInputPort = createInputPort(); - public final IInputPort<Delay<T>, T> objectInputPort = createInputPort(); - - public final IOutputPort<Delay<T>, T> relayOutputPort = createOutputPort(); - - @Override - protected boolean execute(final Context<Delay<T>> context) { - final Object signal = context.tryTake(signalInputPort); - if (signal == null) { - return false; - } - - final T object = context.tryTake(objectInputPort); - if (object == null) { - return false; - } - - context.put(relayOutputPort, object); - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/ObjectProducer.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/ObjectProducer.java deleted file mode 100644 index 710ee6710cf352c38389542d3681316a4fc1be2b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/ObjectProducer.java +++ /dev/null @@ -1,85 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic; - -import java.util.concurrent.Callable; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ObjectProducer<T> extends AbstractFilter<ObjectProducer<T>> { - - public final IOutputPort<ObjectProducer<T>, T> outputPort = this.createOutputPort(); - - private Callable<T> objectCreator; - private long numObjectsToCreate; - - /** - * @since 1.10 - */ - public ObjectProducer(final long numObjectsToCreate, final Callable<T> objectCreator) { - this.numObjectsToCreate = numObjectsToCreate; - this.objectCreator = objectCreator; - } - - /** - * @since 1.10 - */ - public ObjectProducer() { - super(); - } - - @Override - protected boolean execute(final Context<ObjectProducer<T>> context) { - if (this.numObjectsToCreate == 0) { - return false; - } - - try { - final T newObject = this.objectCreator.call(); - context.put(this.outputPort, newObject); - } catch (final Exception e) { - throw new IllegalStateException(e); - } - - this.numObjectsToCreate--; - - return true; - } - - public Callable<T> getObjectCreator() { - return this.objectCreator; - } - - public void setObjectCreator(final Callable<T> objectCreator) { - this.objectCreator = objectCreator; - } - - public long getNumObjectsToCreate() { - return this.numObjectsToCreate; - } - - public void setNumObjectsToCreate(final long numObjectsToCreate) { - this.numObjectsToCreate = numObjectsToCreate; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/RepeaterSource.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/RepeaterSource.java deleted file mode 100644 index 28e6783d28f3eab53c7812c42a1b4a482b696ca7..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/RepeaterSource.java +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class RepeaterSource<T> extends AbstractFilter<RepeaterSource<T>> { - - public final IInputPort<RepeaterSource<T>, Boolean> START = this.createInputPort(); - - public final IOutputPort<RepeaterSource<T>, T> OUTPUT = this.createOutputPort(); - - private final T outputRecord; - private final int num; - - /** - * @since 1.10 - * @param outputRecord - * @param num - */ - private RepeaterSource(final T outputRecord, final int num) { - this.outputRecord = outputRecord; - this.num = num; - } - - /** - * @since 1.10 - * @param outputRecord - * @param num - * @return - */ - // this constructor prevents the programmer from repeating the type argument - public static <T> RepeaterSource<T> create(final T outputRecord, final int num) { - return new RepeaterSource<T>(outputRecord, num); - } - - @Override - protected boolean execute(final Context<RepeaterSource<T>> context) { - final Boolean token = context.tryTake(this.START); - if (token == null) { - return false; - } - - // TODO consider to put only one record per iteration and decrement the num directly - int counter = this.num; - while (counter-- > 0) { - context.put(this.OUTPUT, this.outputRecord); - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CloneStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CloneStrategy.java deleted file mode 100644 index 92b3228b3874d78dd8beb1b84931e5fdca91a281..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CloneStrategy.java +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.distributor; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public final class CloneStrategy<T> implements IDistributorStrategy<T> { - - public <S extends Distributor<T>> boolean distribute(final Context<S> context, final List<IOutputPort<S, ?>> outputPorts, final T input) { - throw new UnsupportedOperationException(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CopyByReferenceStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CopyByReferenceStrategy.java deleted file mode 100644 index c6e0b8e2cd652275fe68b941e55983f5b91eb894..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/CopyByReferenceStrategy.java +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.distributor; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public final class CopyByReferenceStrategy<T> implements IDistributorStrategy<T> { - - @SuppressWarnings("unchecked") - public <S extends Distributor<T>> boolean distribute(final Context<S> context, final List<IOutputPort<S, ?>> outputPorts, final T input) { - for (final IOutputPort<S, ?> port : outputPorts) { - context.put((IOutputPort<S, T>) port, input); - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/Distributor.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/Distributor.java deleted file mode 100644 index 2fceaae65b7726beeb022d064590d0e3f2b0909d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/Distributor.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.distributor; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - * - * @param T - * the type of the input port and the output ports - */ -public class Distributor<T> extends AbstractFilter<Distributor<T>> { - - public final IInputPort<Distributor<T>, T> genericInputPort = this.createInputPort(); - - private IDistributorStrategy<T> strategy = new RoundRobinStrategy<T>(); - - public IDistributorStrategy<T> getStrategy() { - return this.strategy; - } - - public void setStrategy(final IDistributorStrategy<T> strategy) { - this.strategy = strategy; - } - - @Override - protected boolean execute(final Context<Distributor<T>> context) { - final T object = context.tryTake(this.genericInputPort); - if (object == null) { - return false; - } - - return this.strategy.distribute(context, this.getOutputPorts(), object); - } - - public IOutputPort<Distributor<T>, T> getNewOutputPort() { - final IOutputPort<Distributor<T>, T> newOutputPort = this.createOutputPort(); - return newOutputPort; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/IDistributorStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/IDistributorStrategy.java deleted file mode 100644 index fcf4fceddf948b95b12484fe1576ba833d6aca17..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/IDistributorStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.distributor; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public interface IDistributorStrategy<T> { - - public <S extends Distributor<T>> boolean distribute(final Context<S> context, final List<IOutputPort<S, ?>> allOutputPorts, final T input); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/RoundRobinStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/RoundRobinStrategy.java deleted file mode 100644 index 75ad77af4939245490d737f2ea326f5279c84f50..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/distributor/RoundRobinStrategy.java +++ /dev/null @@ -1,48 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.distributor; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public final class RoundRobinStrategy<T> implements IDistributorStrategy<T> { - - private int index = 0; - - public <S extends Distributor<T>> boolean distribute(final Context<S> context, final List<IOutputPort<S, ?>> outputPorts, final T object) { - final IOutputPort<S, T> port = this.getNextPortInRoundRobinOrder(outputPorts); - context.put(port, object); - - return true; - } - - @SuppressWarnings("unchecked") - private <S extends Distributor<T>> IOutputPort<S, T> getNextPortInRoundRobinOrder(final List<IOutputPort<S, ?>> outputPorts) { - final IOutputPort<S, T> port = (IOutputPort<S, T>) outputPorts.get(this.index); - - this.index = (this.index + 1) % outputPorts.size(); - - return port; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/IMergerStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/IMergerStrategy.java deleted file mode 100644 index 000afaba54033f1116e60c098cb65d281b276248..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/IMergerStrategy.java +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.merger; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public interface IMergerStrategy<T> { - - public <S extends Merger<T>> T getNextInput(final Context<S> context, final List<IInputPort<S, ?>> inputPorts); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/Merger.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/Merger.java deleted file mode 100644 index de1effc98f16265d0673cb6dfed00361970a165e..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/Merger.java +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.merger; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.Description; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * - * @author Christian Wulf - * - * @since 1.10 - * - * @param <T> - * the type of the input ports and the output port - */ -@Description("This stage merges data from the input ports, by taking elements according to the chosen merge strategy and by putting them to the output port.") -public class Merger<T> extends AbstractFilter<Merger<T>> { - - public final IOutputPort<Merger<T>, T> outputPort = this.createOutputPort(); - - private IMergerStrategy<T> strategy = new RoundRobinStrategy<T>(); - - public IMergerStrategy<T> getStrategy() { - return this.strategy; - } - - public void setStrategy(final IMergerStrategy<T> strategy) { - this.strategy = strategy; - } - - @Override - protected boolean execute(final Context<Merger<T>> context) { - final T token = this.strategy.getNextInput(context, this.getInputPorts()); - if (token == null) { - return false; - } - - context.put(this.outputPort, token); - return true; - } - - public IInputPort<Merger<T>, T> getNewInputPort() { - final IInputPort<Merger<T>, T> newInputPort = this.createInputPort(); - return newInputPort; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/RoundRobinStrategy.java b/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/RoundRobinStrategy.java deleted file mode 100644 index bf61492d71b6b5ef137f8d48e1a67705416d2826..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/basic/merger/RoundRobinStrategy.java +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.basic.merger; - -import java.util.List; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public final class RoundRobinStrategy<T> implements IMergerStrategy<T> { - - private int index = 0; - - public <S extends Merger<T>> T getNextInput(final Context<S> context, final List<IInputPort<S, ?>> inputPorts) { - int size = inputPorts.size(); - // check each port at most once to avoid a potentially infinite loop - while (size-- > 0) { - final IInputPort<S, T> inputPort = this.getNextPortInRoundRobinOrder(inputPorts); - final T token = context.tryTake(inputPort); - if (token != null) { - return token; - } - } - return null; - } - - @SuppressWarnings("unchecked") - private <S extends Merger<T>> IInputPort<S, T> getNextPortInRoundRobinOrder(final List<IInputPort<S, ?>> inputPorts) { - final IInputPort<S, T> port = (IInputPort<S, T>) inputPorts.get(this.index); - - this.index = (this.index + 1) % inputPorts.size(); - - return port; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/composite/CycledCountingFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/composite/CycledCountingFilter.java deleted file mode 100644 index a3cea02390ae76bb1c6f2808bcb2622d7e165510..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/composite/CycledCountingFilter.java +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.composite; - -import teetime.variant.explicitScheduling.framework.core.IPipe; -import teetime.variant.explicitScheduling.stage.CountingFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CycledCountingFilter<T> extends CountingFilter<T> { - - // BETTER hide the internal ports; the following uncommented lines do not work however - // private final IInputPort<CountingFilter<T>, Long> CURRENT_COUNT = this.createInputPort(); - // private final IOutputPort<CountingFilter<T>, Long> NEW_COUNT = this.createOutputPort(); - - /** - * @since 1.10 - * @param countingPipe - */ - // FIXME a non-default constructor is not allowed - private CycledCountingFilter(final IPipe<Long> countingPipe) { - countingPipe.setSourcePort(this.NEW_COUNT); - countingPipe.setTargetPort(this.CURRENT_COUNT); - // FIXME counting pipe needs to be added to a group - } - - // this constructor prevents the programmer from repeating the type argument - public static <T> CycledCountingFilter<T> create(final IPipe<Long> countingPipe) { - return new CycledCountingFilter<T>(countingPipe); - } - - /** - * @since 1.10 - * @return - */ - public Long getCurrentCount() { - return this.getContext().read(this.CURRENT_COUNT); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/composite/ReadRecordFromCsvFileFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/composite/ReadRecordFromCsvFileFilter.java deleted file mode 100644 index 5f8ebdfb775592834d94a700c65243468be48f85..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/composite/ReadRecordFromCsvFileFilter.java +++ /dev/null @@ -1,65 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.composite; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IPipe; -import teetime.variant.explicitScheduling.stage.io.File2TextLinesFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; -import teetime.variant.explicitScheduling.stage.util.TextLine; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -// FIXME extend from CompositeStage -public class ReadRecordFromCsvFileFilter extends AbstractFilter<File2TextLinesFilter> { - - private final File2TextLinesFilter stage0; - private final TextLine2RecordFilter stage1; - - /** - * @since 1.10 - * @param textLinePipe - */ - public ReadRecordFromCsvFileFilter(final IPipe<TextLine> textLinePipe, final ClassNameRegistryRepository classNameRegistryRepository) { - this.stage0 = new File2TextLinesFilter(); - this.stage1 = new TextLine2RecordFilter(classNameRegistryRepository); - - textLinePipe.setSourcePort(this.stage0.textLineOutputPort); - textLinePipe.setTargetPort(this.stage1.textLineInputPort); - // FIXME textLinePipe needs to be added to a group - - /* - * FIXME a composite filter only serves as a convenient way to connect multiple stages or to realize self-connected queues.<br> - * How should the stage scheduler be aware of these internal stages?<br> - * Should the context not be passed to each of the internal stages? - */ - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<File2TextLinesFilter> context) { - return this.stage0.execute(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/composite/TeeFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/composite/TeeFilter.java deleted file mode 100644 index 6daf7038a29a1247158853a811bd6a0e8e58f57d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/composite/TeeFilter.java +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.composite; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.framework.core.IPipe; -import teetime.variant.explicitScheduling.framework.sequential.MethodCallPipe; -import teetime.variant.explicitScheduling.stage.basic.distributor.Distributor; -import teetime.variant.explicitScheduling.stage.io.Printer; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - */ -public class TeeFilter<T> extends AbstractFilter<TeeFilter<T>> { - - private final Distributor<T> stage0; - private final Printer<T> stage1; - - public TeeFilter(final IPipe<T> pipe) { - this.stage0 = new Distributor<T>(); - this.stage1 = new Printer<T>(); - - final IOutputPort<Distributor<T>, T> outputPort = this.stage0.getNewOutputPort(); - - pipe.setSourcePort(outputPort); - pipe.setTargetPort(this.stage0.genericInputPort); - - final IPipe<T> internalPipeline = new MethodCallPipe<T>(); - internalPipeline.setSourcePort(outputPort); - internalPipeline.setTargetPort(this.stage1.input); - } - - @Override - protected boolean execute(final Context<TeeFilter<T>> context) { - return this.stage0.execute(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/io/DbReader.java b/src/main/java/teetime/variant/explicitScheduling/stage/io/DbReader.java deleted file mode 100644 index 60809bdb3f8b2b0b75358807d5a9349e0abe3d83..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/io/DbReader.java +++ /dev/null @@ -1,187 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.io; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import kieker.common.exception.MonitoringRecordException; -import kieker.common.record.AbstractMonitoringRecord; -import kieker.common.record.IMonitoringRecord; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.Description; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * A very simple database reader that probably only works for small data sets. - * - * @author Jan Waller, Nils Christian Ehmke - * - * @since 1.10 - */ -@Description("A reader which reads records from a database") -public class DbReader extends AbstractFilter<DbReader> { - - private final IOutputPort<DbReader, IMonitoringRecord> outputPort = super.createOutputPort(); - - @Description("The classname of the driver used for the connection.") - private String driverClassname = "org.apache.derby.jdbc.EmbeddedDrive"; - @Description("The connection string used to establish the connection.") - private String connectionString = "jdbc:derby:tmp/KIEKER;user=DBUSER;password=DBPASS"; - @Description("The prefix of the used table within the database.") - private String tablePrefix = "kieker"; - - private volatile boolean running = true; - - @Override - public void onPipelineStarts() throws Exception { - super.onPipelineStarts(); - try { - Class.forName(this.driverClassname).newInstance(); - } catch (final Exception ex) { // NOPMD NOCS (IllegalCatchCheck) - throw new Exception("DB driver registration failed. Perhaps the driver jar is missing?", ex); - } - } - - @Override - public void onPipelineStops() { - super.logger.info("Shutdown of DBReader requested."); - this.running = false; - super.onPipelineStops(); - } - - @Override - protected boolean execute(final Context<DbReader> context) { - Connection connection = null; - try { - connection = DriverManager.getConnection(this.connectionString); - Statement getIndexTable = null; - try { - getIndexTable = connection.createStatement(); - ResultSet indexTable = null; - try { // NOCS (nested try) - indexTable = getIndexTable.executeQuery("SELECT * from " + this.tablePrefix); - while (this.running && indexTable.next()) { - final String tablename = indexTable.getString(1); - final String classname = indexTable.getString(2); - try { // NOCS (nested try) - this.table2record(context, connection, tablename, AbstractMonitoringRecord.classForName(classname)); - } catch (final MonitoringRecordException ex) { - // log error but continue with next table - super.logger.error("Failed to load records of type " + classname + " from table " + tablename, ex); - continue; - } - } - } finally { - if (indexTable != null) { - indexTable.close(); - } - } - } finally { - if (getIndexTable != null) { - getIndexTable.close(); - } - } - } catch (final SQLException ex) { - super.logger.error("SQLException with SQLState: '" + ex.getSQLState() + "' and VendorError: '" + ex.getErrorCode() + "'", ex); - return false; - } finally { - if (connection != null) { - try { - connection.close(); - } catch (final SQLException ex) { - super.logger.error("SQLException with SQLState: '" + ex.getSQLState() + "' and VendorError: '" + ex.getErrorCode() + "'", ex); - } - } - } - return true; - } - - public final String getDriverClassname() { - return this.driverClassname; - } - - public final void setDriverClassname(final String driverClassname) { - this.driverClassname = driverClassname; - } - - public final String getConnectionString() { - return this.connectionString; - } - - public final void setConnectionString(final String connectionString) { - this.connectionString = connectionString; - } - - public final String getTablePrefix() { - return this.tablePrefix; - } - - public final void setTablePrefix(final String tablePrefix) { - this.tablePrefix = tablePrefix; - } - - /** - * This method uses the given table to read records and sends them to the output port. - * - * @param connection - * The connection to the database which will be used. - * @param tablename - * The name of the table containing records. - * @param clazz - * The class of the monitoring records. This will be used to convert the array into the record. - * @throws SQLException - * If something went wrong during the database access. - * @throws MonitoringRecordException - * If the data within the table could not be converted into a valid record. - */ - private void table2record(final Context<DbReader> context, final Connection connection, final String tablename, final Class<? extends IMonitoringRecord> clazz) - throws SQLException, MonitoringRecordException { - Statement selectRecord = null; - try { - selectRecord = connection.createStatement(); - ResultSet records = null; - try { - records = selectRecord.executeQuery("SELECT * from " + tablename); - final int size = records.getMetaData().getColumnCount() - 2; // remove index column - while (this.running && records.next()) { - final Object[] recordValues = new Object[size]; - for (int i = 0; i < size; i++) { - recordValues[i] = records.getObject(i + 3); - } - final IMonitoringRecord record = AbstractMonitoringRecord.createFromArray(clazz, recordValues); - record.setLoggingTimestamp(records.getLong(2)); - context.put(this.outputPort, record); - } - } finally { - if (records != null) { - records.close(); - } - } - } finally { - if (selectRecord != null) { - selectRecord.close(); - } - } - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/io/Directory2FilesFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/io/Directory2FilesFilter.java deleted file mode 100644 index 7e781980c700321747371a9ff1e30236ea199d96..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/io/Directory2FilesFilter.java +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.io; - -import java.io.File; -import java.io.FileFilter; -import java.util.Arrays; -import java.util.Comparator; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class Directory2FilesFilter extends AbstractFilter<Directory2FilesFilter> { - - public final IInputPort<Directory2FilesFilter, File> directoryInputPort = this.createInputPort(); - - public final IOutputPort<Directory2FilesFilter, File> fileOutputPort = this.createOutputPort(); - - private FileFilter filter; - private Comparator<File> fileComparator; - - /** - * @since 1.10 - */ - public Directory2FilesFilter(final FileFilter fileFilter) { - this.setFilter(fileFilter); - } - - /** - * @since 1.10 - */ - public Directory2FilesFilter(final Comparator<File> fileComparator) { - this.setFileComparator(fileComparator); - } - - /** - * @since 1.10 - */ - public Directory2FilesFilter(final FileFilter fileFilter, final Comparator<File> fileComparator) { - this.setFilter(fileFilter); - this.setFileComparator(fileComparator); - } - - /** - * @since 1.10 - */ - public Directory2FilesFilter() { - super(); - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<Directory2FilesFilter> context) { - final File inputDir = context.tryTake(this.directoryInputPort); - if (inputDir == null) { - return false; - } - - final File[] inputFiles = inputDir.listFiles(this.filter); - - if (inputFiles == null) { - this.logger.error("Directory '" + inputDir + "' does not exist or an I/O error occured."); - return true; - } - - if (this.fileComparator != null) { - Arrays.sort(inputFiles, this.fileComparator); - } - - for (final File file : inputFiles) { - context.put(this.fileOutputPort, file); - } - - return true; - } - - public FileFilter getFilter() { - return this.filter; - } - - public void setFilter(final FileFilter filter) { - this.filter = filter; - } - - public Comparator<File> getFileComparator() { - return this.fileComparator; - } - - public void setFileComparator(final Comparator<File> fileComparator) { - this.fileComparator = fileComparator; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/io/File2TextLinesFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/io/File2TextLinesFilter.java deleted file mode 100644 index 08d479ca3125d7d42b4d8b1f83ca898fc835689b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/io/File2TextLinesFilter.java +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.io; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.util.TextLine; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class File2TextLinesFilter extends AbstractFilter<File2TextLinesFilter> { - - public final IInputPort<File2TextLinesFilter, File> fileInputPort = this.createInputPort(); - - public final IOutputPort<File2TextLinesFilter, TextLine> textLineOutputPort = this.createOutputPort(); - - private String charset = "UTF-8"; - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<File2TextLinesFilter> context) { - final File textFile = context.tryTake(this.fileInputPort); - if (textFile == null) { - return false; - } - - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(new FileInputStream(textFile), this.charset)); - String line; - while ((line = reader.readLine()) != null) { - line = line.trim(); - if (line.length() != 0) { - context.put(this.textLineOutputPort, new TextLine(textFile, line)); - } // else: ignore empty line - } - } catch (final FileNotFoundException e) { - this.logger.error("", e); - } catch (final IOException e) { - this.logger.error("", e); - } finally { - try { - if (reader != null) { - reader.close(); - } - } catch (final IOException e) { - this.logger.warn("", e); - } - } - return true; - } - - public String getCharset() { - return this.charset; - } - - public void setCharset(final String charset) { - this.charset = charset; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/io/Printer.java b/src/main/java/teetime/variant/explicitScheduling/stage/io/Printer.java deleted file mode 100644 index a47068af38bfc16c33faf6f6e8f757df8f3a21f6..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/io/Printer.java +++ /dev/null @@ -1,144 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.io; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.PrintStream; -import java.io.UnsupportedEncodingException; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.Description; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Matthias Rohr, Jan Waller, Nils Christian Ehmke - * - * @since 1.10 - */ -@Description("A filter to print objects to a configured stream") -public class Printer<T> extends AbstractFilter<Printer<T>> { - - public static final String STREAM_STDOUT = "STDOUT"; - public static final String STREAM_STDERR = "STDERR"; - public static final String STREAM_STDLOG = "STDlog"; - public static final String STREAM_NULL = "NULL"; - - public static final String ENCODING_UTF8 = "UTF-8"; - - public final IInputPort<Printer<T>, T> input = this.createInputPort(); - - private PrintStream printStream; - private String streamName = STREAM_STDOUT; - private String encoding = ENCODING_UTF8; - private boolean active = true; - private boolean append = true; - - public String getStreamName() { - return this.streamName; - } - - public void setStreamName(final String streamName) { - this.streamName = streamName; - } - - public String getEncoding() { - return this.encoding; - } - - public void setEncoding(final String encoding) { - this.encoding = encoding; - } - - public boolean isAppend() { - return this.append; - } - - public void setAppend(final boolean append) { - this.append = append; - } - - @Override - public void onPipelineStarts() throws Exception { - super.onPipelineStarts(); - this.initializeStream(); - } - - @Override - public void onPipelineStops() { - this.closeStream(); - super.onPipelineStops(); - } - - private void initializeStream() { - if (STREAM_STDOUT.equals(this.streamName)) { - this.printStream = System.out; - this.active = true; - } else if (STREAM_STDERR.equals(this.streamName)) { - this.printStream = System.err; - this.active = true; - } else if (STREAM_STDLOG.equals(this.streamName)) { - this.printStream = null; - this.active = true; - } else if (STREAM_NULL.equals(this.streamName)) { - this.printStream = null; - this.active = false; - } else { - try { - this.printStream = new PrintStream(new FileOutputStream(this.streamName, this.append), false, this.encoding); - this.active = true; - } catch (final FileNotFoundException ex) { - this.active = false; - super.logger.warn("Stream could not be created", ex); - } catch (final UnsupportedEncodingException ex) { - this.active = false; - super.logger.warn("Encoding not supported", ex); - } - } - } - - private void closeStream() { - if ((this.printStream != null) && (this.printStream != System.out) && (this.printStream != System.err)) { - this.printStream.close(); - } - } - - @Override - protected boolean execute(final Context<Printer<T>> context) { - final T object = context.tryTake(this.input); - if (null == object) { - return false; - } - - if (this.active) { - final StringBuilder sb = new StringBuilder(128); - - sb.append(super.getId()); - sb.append('(').append(object.getClass().getSimpleName()).append(") ").append(object.toString()); - - final String msg = sb.toString(); - if (this.printStream != null) { - this.printStream.println(msg); - } else { - super.logger.info(msg); - } - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/io/TCPReader.java b/src/main/java/teetime/variant/explicitScheduling/stage/io/TCPReader.java deleted file mode 100644 index 60dc9bcbde6bc2dfdd213e324be585e85e7e6169..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/io/TCPReader.java +++ /dev/null @@ -1,207 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.io; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.BufferUnderflowException; -import java.nio.ByteBuffer; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; - -import kieker.common.exception.MonitoringRecordException; -import kieker.common.logging.Log; -import kieker.common.logging.LogFactory; -import kieker.common.record.AbstractMonitoringRecord; -import kieker.common.record.IMonitoringRecord; -import kieker.common.record.misc.RegistryRecord; -import kieker.common.util.registry.ILookup; -import kieker.common.util.registry.Lookup; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * This is a reader which reads the records from a TCP port. - * - * @author Jan Waller, Nils Christian Ehmke - * - * @since 1.10 - */ -public class TCPReader extends AbstractFilter<TCPReader> { - - private static final int MESSAGE_BUFFER_SIZE = 65535; - - private final IOutputPort<TCPReader, IMonitoringRecord> outputPort = super.createOutputPort(); - - // BETTER use a non thread-safe implementation to increase performance. A thread-safe version is not necessary. - private final ILookup<String> stringRegistry = new Lookup<String>(); - private int port1 = 10133; - private int port2 = 10134; - - @Override - public void onPipelineStarts() throws Exception { - super.onPipelineStarts(); - - // FIXME use the implementation from the thread or from execute(), but not both - final TCPStringReader tcpStringReader = new TCPStringReader(this.port2, this.stringRegistry); - tcpStringReader.start(); - } - - @Override - public void onPipelineStops() { - super.logger.info("Shutdown of TCPReader requested."); - // TODO actually implement terminate! - super.onPipelineStops(); - } - - public final int getPort1() { - return this.port1; - } - - public final void setPort1(final int port1) { - this.port1 = port1; - } - - public final int getPort2() { - return this.port2; - } - - public final void setPort2(final int port2) { - this.port2 = port2; - } - - @Override - protected boolean execute(final Context<TCPReader> context) { - ServerSocketChannel serversocket = null; - try { - serversocket = ServerSocketChannel.open(); - serversocket.socket().bind(new InetSocketAddress(this.port1)); - if (super.logger.isDebugEnabled()) { - super.logger.debug("Listening on port " + this.port1); - } - // BEGIN also loop this one? - final SocketChannel socketChannel = serversocket.accept(); - final ByteBuffer buffer = ByteBuffer.allocateDirect(MESSAGE_BUFFER_SIZE); - while (socketChannel.read(buffer) != -1) { - buffer.flip(); - // System.out.println("Reading, remaining:" + buffer.remaining()); - try { - while (buffer.hasRemaining()) { - buffer.mark(); - final int clazzid = buffer.getInt(); - final long loggingTimestamp = buffer.getLong(); - final IMonitoringRecord record; - try { // NOCS (Nested try-catch) - record = AbstractMonitoringRecord.createFromByteBuffer(clazzid, buffer, this.stringRegistry); - record.setLoggingTimestamp(loggingTimestamp); - context.put(this.outputPort, record); - } catch (final MonitoringRecordException ex) { - super.logger.error("Failed to create record.", ex); - } - } - buffer.clear(); - } catch (final BufferUnderflowException ex) { - buffer.reset(); - // System.out.println("Underflow, remaining:" + buffer.remaining()); - buffer.compact(); - } - } - // System.out.println("Channel closing..."); - socketChannel.close(); - // END also loop this one? - } catch (final IOException ex) { - super.logger.error("Error while reading", ex); - return false; - } finally { - if (null != serversocket) { - try { - serversocket.close(); - } catch (final IOException e) { - if (super.logger.isDebugEnabled()) { - super.logger.debug("Failed to close TCP connection!", e); - } - } - } - } - return true; - } - -} - -/** - * - * @author Jan Waller - * - * @since 1.8 - */ -class TCPStringReader extends Thread { - - private static final int MESSAGE_BUFFER_SIZE = 65535; - - private static final Log LOG = LogFactory.getLog(TCPStringReader.class); - - private final int port; - private final ILookup<String> stringRegistry; - - public TCPStringReader(final int port, final ILookup<String> stringRegistry) { - this.port = port; - this.stringRegistry = stringRegistry; - } - - @Override - public void run() { - ServerSocketChannel serversocket = null; - try { - serversocket = ServerSocketChannel.open(); - serversocket.socket().bind(new InetSocketAddress(this.port)); - if (LOG.isDebugEnabled()) { - LOG.debug("Listening on port " + this.port); - } - // BEGIN also loop this one? - final SocketChannel socketChannel = serversocket.accept(); - final ByteBuffer buffer = ByteBuffer.allocateDirect(MESSAGE_BUFFER_SIZE); - while (socketChannel.read(buffer) != -1) { - buffer.flip(); - try { - while (buffer.hasRemaining()) { - buffer.mark(); - RegistryRecord.registerRecordInRegistry(buffer, this.stringRegistry); - } - buffer.clear(); - } catch (final BufferUnderflowException ex) { - buffer.reset(); - buffer.compact(); - } - } - socketChannel.close(); - // END also loop this one? - } catch (final IOException ex) { - LOG.error("Error while reading", ex); - } finally { - if (null != serversocket) { - try { - serversocket.close(); - } catch (final IOException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("Failed to close TCP connection!", e); - } - } - } - } - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/File2RecordFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/File2RecordFilter.java deleted file mode 100644 index d2a2193daf3cae9e3196b1ef537282e9f6bb10af..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/File2RecordFilter.java +++ /dev/null @@ -1,144 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker; - -import java.io.File; - -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipeFactory; -import teetime.variant.explicitScheduling.framework.core.CompositeFilter; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.FileExtensionFilter; -import teetime.variant.explicitScheduling.stage.basic.merger.Merger; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryCreationFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.BinaryFile2RecordFilter; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.DatFile2RecordFilter; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.ZipFile2RecordFilter; -import teetime.variant.explicitScheduling.stage.predicate.IsDirectoryPredicate; -import teetime.variant.explicitScheduling.stage.predicate.PredicateFilter; - -import kieker.common.record.IMonitoringRecord; -import kieker.common.util.filesystem.BinaryCompressionMethod; -import kieker.common.util.filesystem.FSUtil; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class File2RecordFilter extends CompositeFilter { - - public final IInputPort<PredicateFilter<File>, File> fileInputPort; - - public final IOutputPort<Merger<IMonitoringRecord>, IMonitoringRecord> recordOutputPort; - - private ClassNameRegistryRepository classNameRegistryRepository; - - /** - * @since 1.10 - */ - public File2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { - this.classNameRegistryRepository = classNameRegistryRepository; - - // FIXME does not yet work with more than one thread due to classNameRegistryRepository (reason not comprehensible) - // create stages - final PredicateFilter<File> isDirectoryFilter = new PredicateFilter<File>(new IsDirectoryPredicate()); - final ClassNameRegistryCreationFilter classNameRegistryCreationFilter = new ClassNameRegistryCreationFilter(this.classNameRegistryRepository); - final MonitoringLogDirectory2Files directory2FilesFilter = new MonitoringLogDirectory2Files(); - final FileExtensionFilter fileExtensionFilter = new FileExtensionFilter(); - final Merger<File> fileMerger = new Merger<File>(); - - final DatFile2RecordFilter datFile2RecordFilter = new DatFile2RecordFilter(this.classNameRegistryRepository); - final BinaryFile2RecordFilter binaryFile2RecordFilter = new BinaryFile2RecordFilter(this.classNameRegistryRepository); - final ZipFile2RecordFilter zipFile2RecordFilter = new ZipFile2RecordFilter(); - - final Merger<IMonitoringRecord> recordMerger = new Merger<IMonitoringRecord>(); - - // store ports due to readability reasons - final IOutputPort<FileExtensionFilter, File> normalFileOutputPort = fileExtensionFilter.createOutputPortForFileExtension(FSUtil.NORMAL_FILE_EXTENSION); - final IOutputPort<FileExtensionFilter, File> binFileOutputPort = fileExtensionFilter.createOutputPortForFileExtension(BinaryCompressionMethod.NONE - .getFileExtension()); - final IOutputPort<FileExtensionFilter, File> zipFileOutputPort = fileExtensionFilter.createOutputPortForFileExtension(FSUtil.ZIP_FILE_EXTENSION); - - // connect ports by pipes - this.connectWithPipe(isDirectoryFilter.matchingOutputPort, classNameRegistryCreationFilter.directoryInputPort); - this.connectWithPipe(isDirectoryFilter.mismatchingOutputPort, fileMerger.getNewInputPort()); // BETTER restructure pipeline - this.connectWithPipe(classNameRegistryCreationFilter.relayDirectoryOutputPort, directory2FilesFilter.directoryInputPort); - this.connectWithPipe(classNameRegistryCreationFilter.filePrefixOutputPort, directory2FilesFilter.filePrefixInputPort); - this.connectWithPipe(directory2FilesFilter.fileOutputPort, fileExtensionFilter.fileInputPort); - this.connectWithPipe(zipFileOutputPort, fileMerger.getNewInputPort()); - - final ConcurrentWorkStealingPipeFactory<File> concurrentWorkStealingPipeFactory0 = new ConcurrentWorkStealingPipeFactory<File>(); - final ConcurrentWorkStealingPipe<File> concurrentWorkStealingPipe0 = concurrentWorkStealingPipeFactory0.create(); - concurrentWorkStealingPipe0.setSourcePort(normalFileOutputPort); - concurrentWorkStealingPipe0.setTargetPort(datFile2RecordFilter.fileInputPort); - - final ConcurrentWorkStealingPipeFactory<File> concurrentWorkStealingPipeFactory1 = new ConcurrentWorkStealingPipeFactory<File>(); - final ConcurrentWorkStealingPipe<File> concurrentWorkStealingPipe1 = concurrentWorkStealingPipeFactory1.create(); - concurrentWorkStealingPipe1.setSourcePort(binFileOutputPort); - concurrentWorkStealingPipe1.setTargetPort(binaryFile2RecordFilter.fileInputPort); - - final ConcurrentWorkStealingPipeFactory<File> concurrentWorkStealingPipeFactory2 = new ConcurrentWorkStealingPipeFactory<File>(); - final ConcurrentWorkStealingPipe<File> concurrentWorkStealingPipe2 = concurrentWorkStealingPipeFactory2.create(); - concurrentWorkStealingPipe2.setSourcePort(fileMerger.outputPort); - concurrentWorkStealingPipe2.setTargetPort(zipFile2RecordFilter.fileInputPort); - - final ConcurrentWorkStealingPipeFactory<IMonitoringRecord> concurrentWorkStealingPipeFactoriesNormal = new ConcurrentWorkStealingPipeFactory<IMonitoringRecord>(); - final ConcurrentWorkStealingPipe<IMonitoringRecord> datPipe = concurrentWorkStealingPipeFactoriesNormal.create(); - datPipe.connect(datFile2RecordFilter.recordOutputPort, recordMerger.getNewInputPort()); - - final ConcurrentWorkStealingPipeFactory<IMonitoringRecord> concurrentWorkStealingPipeFactoriesBinary = new ConcurrentWorkStealingPipeFactory<IMonitoringRecord>(); - final ConcurrentWorkStealingPipe<IMonitoringRecord> binaryPipe = concurrentWorkStealingPipeFactoriesBinary.create(); - binaryPipe.connect(binaryFile2RecordFilter.recordOutputPort, recordMerger.getNewInputPort()); - - final ConcurrentWorkStealingPipeFactory<IMonitoringRecord> concurrentWorkStealingPipeFactoriesZip = new ConcurrentWorkStealingPipeFactory<IMonitoringRecord>(); - final ConcurrentWorkStealingPipe<IMonitoringRecord> zipPipe = concurrentWorkStealingPipeFactoriesZip.create(); - zipPipe.connect(zipFile2RecordFilter.recordOutputPort, recordMerger.getNewInputPort()); - - this.fileInputPort = isDirectoryFilter.inputPort; - this.recordOutputPort = recordMerger.outputPort; - - this.schedulableStages.add(isDirectoryFilter); - - // this.schedulableStages.add(classNameRegistryCreationFilter); - // this.schedulableStages.add(directory2FilesFilter); - // this.schedulableStages.add(fileMerger); - // this.schedulableStages.add(fileExtensionFilter); - - this.schedulableStages.add(datFile2RecordFilter); - this.schedulableStages.add(binaryFile2RecordFilter); - this.schedulableStages.add(zipFile2RecordFilter); - this.schedulableStages.add(recordMerger); - } - - /** - * @since 1.10 - */ - public File2RecordFilter() { - this(null); - } - - public ClassNameRegistryRepository getClassNameRegistryRepository() { - return this.classNameRegistryRepository; - } - - public void setClassNameRegistryRepository(final ClassNameRegistryRepository classNameRegistryRepository) { - this.classNameRegistryRepository = classNameRegistryRepository; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/MonitoringLogDirectory2Files.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/MonitoringLogDirectory2Files.java deleted file mode 100644 index 142be117ce3014e1d46a177a0e95008f075b8161..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/MonitoringLogDirectory2Files.java +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker; - -import java.io.File; -import java.io.FileFilter; -import java.util.Comparator; - -import kieker.common.util.filesystem.BinaryCompressionMethod; -import kieker.common.util.filesystem.FSUtil; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.stage.io.Directory2FilesFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MonitoringLogDirectory2Files extends Directory2FilesFilter { - - public final IInputPort<Directory2FilesFilter, String> filePrefixInputPort = this.createInputPort(); - - /** - * @author Christian Wulf - * - * @since 1.10 - */ - static class MonitoringLogFileFilter implements FileFilter { - private String filePrefix; - - @Override - public boolean accept(final File pathname) { - final String name = pathname.getName(); - return pathname.isFile() - && name.startsWith(this.filePrefix) - && (name.endsWith(FSUtil.NORMAL_FILE_EXTENSION) || BinaryCompressionMethod.hasValidFileExtension(name)); - } - - public String getFilePrefix() { - return this.filePrefix; - } - - public void setFilePrefix(final String filePrefix) { - this.filePrefix = filePrefix; - } - } - - private static final Comparator<File> FILE_COMPARATOR = new Comparator<File>() { - @Override - public final int compare(final File f1, final File f2) { - return f1.compareTo(f2); // simplified (we expect no dirs!) - } - }; - - /** - * @since 1.10 - */ - public MonitoringLogDirectory2Files() { - super(new MonitoringLogFileFilter(), FILE_COMPARATOR); - } - - @Override - protected boolean execute(final Context<Directory2FilesFilter> context) { - final String filePrefix = context.tryTake(this.filePrefixInputPort); - if (filePrefix == null) { - return false; - } - - ((MonitoringLogFileFilter) this.getFilter()).setFilePrefix(filePrefix); - - return super.execute(context); - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryCreationFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryCreationFilter.java deleted file mode 100644 index 6f4fdf16a5e1ce26bcea21ad6132b47e6bc6699a..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/ClassNameRegistryCreationFilter.java +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.className; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ClassNameRegistryCreationFilter extends AbstractFilter<ClassNameRegistryCreationFilter> { - - public final IInputPort<ClassNameRegistryCreationFilter, File> directoryInputPort = this.createInputPort(); - - public final IOutputPort<ClassNameRegistryCreationFilter, File> relayDirectoryOutputPort = this.createOutputPort(); - public final IOutputPort<ClassNameRegistryCreationFilter, String> filePrefixOutputPort = this.createOutputPort(); - - private ClassNameRegistryRepository classNameRegistryRepository; - - private final MappingFileParser mappingFileParser; - - /** - * @since 1.10 - */ - public ClassNameRegistryCreationFilter(final ClassNameRegistryRepository classNameRegistryRepository) { - this(); - this.classNameRegistryRepository = classNameRegistryRepository; - } - - /** - * @since 1.10 - */ - public ClassNameRegistryCreationFilter() { - super(); - this.mappingFileParser = new MappingFileParser(this.logger); - } - - @Override - protected boolean execute(final Context<ClassNameRegistryCreationFilter> context) { - final File inputDir = context.tryTake(this.directoryInputPort); - if (inputDir == null) { - return false; - } - - final File mappingFile = this.mappingFileParser.findMappingFile(inputDir); - if (mappingFile == null) { - return true; - } - - try { - final ClassNameRegistry classNameRegistry = this.mappingFileParser.parseFromStream(new FileInputStream(mappingFile)); - this.classNameRegistryRepository.put(inputDir, classNameRegistry); - context.put(this.relayDirectoryOutputPort, inputDir); - - final String filePrefix = this.mappingFileParser.getFilePrefixFromMappingFile(mappingFile); - context.put(this.filePrefixOutputPort, filePrefix); - } catch (final FileNotFoundException e) { - this.logger.error("Mapping file not found.", e); // and skip this directory - } - - return true; - } - - public ClassNameRegistryRepository getClassNameRegistryRepository() { - return this.classNameRegistryRepository; - } - - public void setClassNameRegistryRepository(final ClassNameRegistryRepository classNameRegistryRepository) { - this.classNameRegistryRepository = classNameRegistryRepository; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/MappingFileParser.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/MappingFileParser.java deleted file mode 100644 index 9578f48a1785b86f324e4ab4a8faa70da2a7680c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/className/MappingFileParser.java +++ /dev/null @@ -1,130 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.className; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -import kieker.common.logging.Log; -import kieker.common.util.filesystem.FSUtil; - -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistry; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MappingFileParser { - - protected Log logger; - - private static final Map<String, String> filePrefixRegistry = new HashMap<String, String>(); - - static { - filePrefixRegistry.put(FSUtil.MAP_FILENAME, FSUtil.FILE_PREFIX); - filePrefixRegistry.put(FSUtil.LEGACY_MAP_FILENAME, FSUtil.LEGACY_FILE_PREFIX); - } - - public MappingFileParser(final Log logger) { - this.logger = logger; - } - - public ClassNameRegistry parseFromStream(final InputStream inputStream) { - final ClassNameRegistry classNameRegistry = new ClassNameRegistry(); - - BufferedReader in = null; - try { - in = new BufferedReader(new InputStreamReader(inputStream, FSUtil.ENCODING)); - String line; - while ((line = in.readLine()) != null) { // NOPMD (assign) - this.parseTextLine(line, classNameRegistry); - } - } catch (final IOException ex) { - this.logger.error("Error reading mapping file", ex); - } finally { - if (in != null) { - try { - in.close(); - } catch (final IOException ex) { - this.logger.error("Exception while closing input stream for mapping file", ex); - } - } - } - - return classNameRegistry; - } - - private void parseTextLine(final String line, final Map<Integer, String> stringRegistry) { - if (line.length() == 0) { - return; // ignore empty lines - } - final int split = line.indexOf('='); - if (split == -1) { - this.logger.error("Failed to find character '=' in line: {" + line + "}. It must consist of a ID=VALUE pair."); - return; // continue on errors - } - final String key = line.substring(0, split); - final String value = FSUtil.decodeNewline(line.substring(split + 1)); - // the leading $ is optional - final Integer id; - try { - id = Integer.valueOf((key.charAt(0) == '$') ? key.substring(1) : key); // NOCS - } catch (final NumberFormatException ex) { - this.logger.error("Error reading mapping file, id must be integer", ex); - return; // continue on errors - } - final String prevVal = stringRegistry.put(id, value); - if (prevVal != null) { - this.logger.error("Found addional entry for id='" + id + "', old value was '" + prevVal + "' new value is '" + value + "'"); - } - } - - /** - * @since 1.10 - */ - public File findMappingFile(final File dirPath) { - File mappingFile = new File(dirPath, FSUtil.MAP_FILENAME); - if (!mappingFile.exists()) { - // No mapping file found. Check whether we find a legacy tpmon.map file! - mappingFile = new File(dirPath, FSUtil.LEGACY_MAP_FILENAME); - if (mappingFile.exists()) { - this.logger.info("Directory '" + dirPath + "' contains no file '" + FSUtil.MAP_FILENAME + "'. Found '" + FSUtil.LEGACY_MAP_FILENAME - + "' ... switching to legacy mode"); - } else { - // no {kieker|tpmon}.map exists. This is valid for very old monitoring logs. Hence, only dump a log.warn - this.logger.warn("No mapping file in directory '" + dirPath.getAbsolutePath() + "'"); - return null; - } - } - - return mappingFile; - } - - /** - * @return <code>null</code> if a file prefix for the given <code>mappingFile</code> is not registered. - * @since 1.10 - */ - public String getFilePrefixFromMappingFile(final File mappingFile) { - return MappingFileParser.filePrefixRegistry.get(mappingFile.getName()); - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java deleted file mode 100644 index 34cc0e7fe6665a4d67288995f360a5071b1e518d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/BinaryFile2RecordFilter.java +++ /dev/null @@ -1,113 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord; - -import java.io.DataInputStream; -import java.io.File; -import java.io.IOException; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; - -import kieker.common.exception.MonitoringRecordException; -import kieker.common.record.IMonitoringRecord; -import kieker.common.util.filesystem.BinaryCompressionMethod; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class BinaryFile2RecordFilter extends AbstractFilter<BinaryFile2RecordFilter> { - - private static final int MB = 1024 * 1024; - - public final IInputPort<BinaryFile2RecordFilter, File> fileInputPort = this.createInputPort(); - public final IOutputPort<BinaryFile2RecordFilter, IMonitoringRecord> recordOutputPort = this.createOutputPort(); - - private RecordFromBinaryFileCreator recordFromBinaryFileCreator; - - private ClassNameRegistryRepository classNameRegistryRepository; - - /** - * @since 1.10 - */ - public BinaryFile2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { - this(); - this.classNameRegistryRepository = classNameRegistryRepository; - } - - /** - * @since 1.10 - */ - public BinaryFile2RecordFilter() { - super(); - } - - @Override - public void onPipelineStarts() throws Exception { - this.recordFromBinaryFileCreator = new RecordFromBinaryFileCreator(this.logger, this.classNameRegistryRepository); - super.onPipelineStarts(); - } - - @Override - protected boolean execute(final Context<BinaryFile2RecordFilter> context) { - final File binaryFile = context.tryTake(this.fileInputPort); - if (binaryFile == null) { - return false; - } - - try { - final BinaryCompressionMethod method = BinaryCompressionMethod.getByFileExtension(binaryFile.getName()); - final DataInputStream in = method.getDataInputStream(binaryFile, 1 * MB); - try { - IMonitoringRecord record = this.recordFromBinaryFileCreator.createRecordFromBinaryFile(binaryFile, in); - while (record != null) { - context.put(this.recordOutputPort, record); - record = this.recordFromBinaryFileCreator.createRecordFromBinaryFile(binaryFile, in); - } - } catch (final MonitoringRecordException e) { - this.logger.error("Error reading file: " + binaryFile, e); - } finally { - if (in != null) { - try { - in.close(); - } catch (final IOException ex) { - this.logger.error("Exception while closing input stream for processing input file", ex); - } - } - } - } catch (final IOException e) { - this.logger.error("Error reading file: " + binaryFile, e); - } catch (final IllegalArgumentException e) { - this.logger.warn("Unknown file extension for file: " + binaryFile); - } - - return true; - } - - public ClassNameRegistryRepository getClassNameRegistryRepository() { - return this.classNameRegistryRepository; - } - - public void setClassNameRegistryRepository(final ClassNameRegistryRepository classNameRegistryRepository) { - this.classNameRegistryRepository = classNameRegistryRepository; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/DatFile2RecordFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/DatFile2RecordFilter.java deleted file mode 100644 index db67b0131ee9c45103a5560fb70ecc51ba38da25..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/DatFile2RecordFilter.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord; - -import java.io.File; - -import kieker.common.record.IMonitoringRecord; - -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.variant.explicitScheduling.framework.concurrent.ConcurrentWorkStealingPipeFactory; -import teetime.variant.explicitScheduling.framework.core.CompositeFilter; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.io.File2TextLinesFilter; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine.TextLine2RecordFilter; -import teetime.variant.explicitScheduling.stage.util.TextLine; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class DatFile2RecordFilter extends CompositeFilter { - - public final IInputPort<File2TextLinesFilter, File> fileInputPort; - - public final IOutputPort<TextLine2RecordFilter, IMonitoringRecord> recordOutputPort; - - public DatFile2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { - final File2TextLinesFilter file2TextLinesFilter = new File2TextLinesFilter(); - final TextLine2RecordFilter textLine2RecordFilter = new TextLine2RecordFilter(classNameRegistryRepository); - - // FIXME extract pipe implementation - final ConcurrentWorkStealingPipeFactory<TextLine> concurrentWorkStealingPipeFactory = new ConcurrentWorkStealingPipeFactory<TextLine>(); - final ConcurrentWorkStealingPipe<TextLine> pipe = concurrentWorkStealingPipeFactory.create(); - pipe.connect(file2TextLinesFilter.textLineOutputPort, textLine2RecordFilter.textLineInputPort); - - this.fileInputPort = file2TextLinesFilter.fileInputPort; - this.recordOutputPort = textLine2RecordFilter.recordOutputPort; - - this.schedulableStages.add(file2TextLinesFilter); - this.schedulableStages.add(textLine2RecordFilter); - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java deleted file mode 100644 index c7dd5d198da67408d348afe647339826ec7af4d3..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/RecordFromBinaryFileCreator.java +++ /dev/null @@ -1,117 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord; - -import java.io.DataInputStream; -import java.io.EOFException; -import java.io.File; -import java.io.IOException; - -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistry; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; - -import kieker.common.exception.MonitoringRecordException; -import kieker.common.logging.Log; -import kieker.common.record.AbstractMonitoringRecord; -import kieker.common.record.IMonitoringRecord; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class RecordFromBinaryFileCreator { - - private final Log logger; - private final ClassNameRegistryRepository classNameRegistryRepository; - - public RecordFromBinaryFileCreator(final Log logger, final ClassNameRegistryRepository classNameRegistryRepository) { - this.logger = logger; - this.classNameRegistryRepository = classNameRegistryRepository; - } - - public IMonitoringRecord createRecordFromBinaryFile(final File binaryFile, final DataInputStream inputStream) throws IOException, MonitoringRecordException { - final ClassNameRegistry classNameRegistry = this.classNameRegistryRepository.get(binaryFile.getParentFile()); - - final Integer id; - try { - id = inputStream.readInt(); - } catch (final EOFException eof) { - return null; // we are finished - } - final String classname = classNameRegistry.get(id); - if (classname == null) { - this.logger.error("Missing classname mapping for record type id " + "'" + id + "'"); - return null; // we can't easily recover on errors - } - - final Class<? extends IMonitoringRecord> clazz = AbstractMonitoringRecord.classForName(classname); - final Class<?>[] typeArray = AbstractMonitoringRecord.typesForClass(clazz); - - // read record - final long loggingTimestamp = inputStream.readLong(); // NOPMD (must be read here!) - final Object[] objectArray = new Object[typeArray.length]; - int idx = -1; - for (final Class<?> type : typeArray) { - idx++; - boolean successful = this.writeToObjectArray(inputStream, classNameRegistry, clazz, objectArray, idx, type); - if (!successful) { - return null; - } - } - final IMonitoringRecord record = AbstractMonitoringRecord.createFromArray(clazz, objectArray); - record.setLoggingTimestamp(loggingTimestamp); - - return record; - } - - private boolean writeToObjectArray(final DataInputStream inputStream, final ClassNameRegistry classNameRegistry, final Class<? extends IMonitoringRecord> clazz, - final Object[] objectArray, final int idx, final Class<?> type) throws IOException { - if (type == String.class) { - final Integer strId = inputStream.readInt(); - final String str = classNameRegistry.get(strId); - if (str == null) { - this.logger.error("No String mapping found for id " + strId.toString()); - objectArray[idx] = ""; - } else { - objectArray[idx] = str; - } - } else if ((type == int.class) || (type == Integer.class)) { - objectArray[idx] = inputStream.readInt(); - } else if ((type == long.class) || (type == Long.class)) { - objectArray[idx] = inputStream.readLong(); - } else if ((type == float.class) || (type == Float.class)) { - objectArray[idx] = inputStream.readFloat(); - } else if ((type == double.class) || (type == Double.class)) { - objectArray[idx] = inputStream.readDouble(); - } else if ((type == byte.class) || (type == Byte.class)) { - objectArray[idx] = inputStream.readByte(); - } else if ((type == short.class) || (type == Short.class)) { // NOPMD (short) - objectArray[idx] = inputStream.readShort(); - } else if ((type == boolean.class) || (type == Boolean.class)) { - objectArray[idx] = inputStream.readBoolean(); - } else { - if (inputStream.readByte() != 0) { - this.logger.error("Unexpected value for unsupported type: " + clazz.getName()); - return false; // breaking error (break would not terminate the correct loop) - } - this.logger.warn("Unsupported type: " + clazz.getName()); - objectArray[idx] = null; - } - - return true; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/ZipFile2RecordFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/ZipFile2RecordFilter.java deleted file mode 100644 index 7c88e0341c22f34d55a1ec14f80600731c83785f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/ZipFile2RecordFilter.java +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord; - -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistry; -import teetime.variant.explicitScheduling.stage.kieker.className.MappingFileParser; - -import kieker.common.record.IMonitoringRecord; -import kieker.common.util.filesystem.FSUtil; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ZipFile2RecordFilter extends AbstractFilter<ZipFile2RecordFilter> { - - public final IInputPort<ZipFile2RecordFilter, File> fileInputPort = this.createInputPort(); - - public final IOutputPort<ZipFile2RecordFilter, IMonitoringRecord> recordOutputPort = this.createOutputPort(); - - private final MappingFileParser mappingFileParser; - - /** - * @since 1.10 - */ - public ZipFile2RecordFilter() { - this.mappingFileParser = new MappingFileParser(this.logger); - } - - @Override - protected boolean execute(final Context<ZipFile2RecordFilter> context) { - final File zipFile = context.tryTake(this.fileInputPort); - if (zipFile == null) { - return false; - } - - final InputStream mappingFileInputStream = this.findMappingFileInputStream(zipFile); - if (mappingFileInputStream == null) { - return true; - } - final ClassNameRegistry classNameRegistry = this.mappingFileParser.parseFromStream(mappingFileInputStream); - - try { - this.createAndSendRecordsFromZipFile(context, zipFile, classNameRegistry); - } catch (final FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return true; - } - - private void createAndSendRecordsFromZipFile(final Context<ZipFile2RecordFilter> context, final File zipFile, final ClassNameRegistry classNameRegistry) - throws FileNotFoundException { - final ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(zipFile)); - // BufferedReader reader; - // try { - // reader = new BufferedReader(new InputStreamReader(zipInputStream, FSUtil.ENCODING)); - // } catch (final UnsupportedEncodingException e) { - // this.logger.error("This exception should never occur.", e); - // return; - // } finally { - // if (null != reader) { - // try { - // reader.close(); - // } catch (IOException e) { - // throw new IllegalStateException(e); - // } - // } - // } - final DataInputStream input = new DataInputStream(new BufferedInputStream(zipInputStream, 1024 * 1024)); - - ZipEntry zipEntry; - try { - while (null != (zipEntry = zipInputStream.getNextEntry())) { // NOCS NOPMD - final String filename = zipEntry.getName(); - // TODO - } - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private InputStream findMappingFileInputStream(final File zipFile) { - ZipInputStream zipInputStream = null; - try { - zipInputStream = new ZipInputStream(new FileInputStream(zipFile)); - ZipEntry zipEntry; - while ((null != (zipEntry = zipInputStream.getNextEntry())) && !zipEntry.getName().equals(FSUtil.MAP_FILENAME)) { // NOCS NOPMD - // do nothing, just skip to the map file if present - } - if (null == zipEntry) { - this.logger.error("The zip file does not contain a Kieker log: " + zipFile.toString()); - return null; - } - return zipInputStream; - } catch (final IOException ex) { - this.logger.error("Error accessing ZipInputStream", ex); - } finally { - if (null != zipInputStream) { - try { - zipInputStream.close(); - } catch (final IOException ex) { - this.logger.error("Failed to close ZipInputStream", ex); - } - } - } - - return null; - } -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java deleted file mode 100644 index 81f0fb3f0087d879208a1d0bdfc2f831a26003a0..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2MappingRegistryFilter.java +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine; - -import java.util.Map; - -import kieker.common.util.filesystem.FSUtil; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TextLine2MappingRegistryFilter extends AbstractFilter<TextLine2MappingRegistryFilter> { - - public final IInputPort<TextLine2MappingRegistryFilter, String> TEXT_LINE = this.createInputPort(); - - private final Map<Integer, String> stringRegistry; - - public TextLine2MappingRegistryFilter(final Map<Integer, String> stringRegistry) { - this.stringRegistry = stringRegistry; - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<TextLine2MappingRegistryFilter> context) { - final String textLine = context.tryTake(this.TEXT_LINE); - if (textLine == null) { - return false; - } - - final int split = textLine.indexOf('='); - if (split == -1) { - this.logger.error("Failed to find character '=' in line: {" + textLine + "}. It must consist of a ID=VALUE pair."); - return true; - } - final String key = textLine.substring(0, split); - // BETTER execute split instead of checking it before with multiple string operations - final String value = FSUtil.decodeNewline(textLine.substring(split + 1)); - // the leading $ is optional - final Integer id; - try { - id = Integer.valueOf((key.charAt(0) == '$') ? key.substring(1) : key); // NOCS - } catch (final NumberFormatException ex) { - this.logger.error("Error reading mapping file, id must be integer", ex); - return true; // continue on errors - } - final String prevVal = this.stringRegistry.put(id, value); - if (prevVal != null) { - this.logger.error("Found additional entry for id='" + id + "', old value was '" + prevVal + "' new value is '" + value + "'"); - return true; - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java deleted file mode 100644 index d48b77683ad228b99899c3ffa73af2b702e2f7c0..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/fileToRecord/textLine/TextLine2RecordFilter.java +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.fileToRecord.textLine; - -import java.util.HashSet; -import java.util.Set; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.MappingException; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.explicitScheduling.stage.kieker.fileToRecord.RecordFromTextLineCreator; -import teetime.variant.explicitScheduling.stage.util.TextLine; - -import kieker.common.exception.IllegalRecordFormatException; -import kieker.common.exception.MonitoringRecordException; -import kieker.common.exception.UnknownRecordTypeException; -import kieker.common.record.IMonitoringRecord; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TextLine2RecordFilter extends AbstractFilter<TextLine2RecordFilter> { - - public final IInputPort<TextLine2RecordFilter, TextLine> textLineInputPort = this.createInputPort(); - - public final IOutputPort<TextLine2RecordFilter, IMonitoringRecord> recordOutputPort = this.createOutputPort(); - - private final Set<String> unknownTypesObserved = new HashSet<String>(); - - private boolean ignoreUnknownRecordTypes; - - private boolean abortDueToUnknownRecordType; - - private RecordFromTextLineCreator recordFromTextLineCreator; - - /** - * @since 1.10 - */ - public TextLine2RecordFilter(final ClassNameRegistryRepository classNameRegistryRepository) { - this.recordFromTextLineCreator = new RecordFromTextLineCreator(classNameRegistryRepository); - } - - /** - * @since 1.10 - */ - public TextLine2RecordFilter() { - super(); - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<TextLine2RecordFilter> context) { - final TextLine textLine = context.tryTake(this.textLineInputPort); - if (textLine == null) { - return false; - } - - try { - final IMonitoringRecord record = this.recordFromTextLineCreator.createRecordFromLine(textLine.getTextFile(), textLine.getTextLine()); - context.put(this.recordOutputPort, record); - } catch (final MonitoringRecordException e) { - this.logger.error("Could not create record from text line: '" + textLine + "'", e); - } catch (final IllegalRecordFormatException e) { - this.logger.error("Illegal record format: " + textLine, e); - } catch (final MappingException e) { - this.logger.error("", e); - } catch (final UnknownRecordTypeException e) { - final String classname = e.getClassName(); - if (!this.ignoreUnknownRecordTypes) { - this.abortDueToUnknownRecordType = true; - this.logger.error("Failed to load record type " + classname, e); - } else if (!this.unknownTypesObserved.contains(classname)) { - this.unknownTypesObserved.add(classname); - this.logger.error("Failed to load record type " + classname, e); // log once for this type - } - } - - return true; - } - - public boolean isIgnoreUnknownRecordTypes() { - return this.ignoreUnknownRecordTypes; - } - - public void setIgnoreUnknownRecordTypes(final boolean ignoreUnknownRecordTypes) { - this.ignoreUnknownRecordTypes = ignoreUnknownRecordTypes; - } - - public RecordFromTextLineCreator getRecordFromTextLineCreator() { - return this.recordFromTextLineCreator; - } - - public void setRecordFromTextLineCreator(final RecordFromTextLineCreator recordFromTextLineCreator) { - this.recordFromTextLineCreator = recordFromTextLineCreator; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/traceReconstruction/TraceReconstructionFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/kieker/traceReconstruction/TraceReconstructionFilter.java deleted file mode 100644 index daf352650b5d524963821a35e8699b88aa183ac7..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/kieker/traceReconstruction/TraceReconstructionFilter.java +++ /dev/null @@ -1,192 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.kieker.traceReconstruction; - -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; - -import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; -import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -import kieker.analysis.plugin.filter.flow.TraceEventRecords; -import kieker.common.record.flow.IFlowRecord; -import kieker.common.record.flow.trace.AbstractTraceEvent; -import kieker.common.record.flow.trace.TraceMetadata; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class TraceReconstructionFilter extends AbstractFilter<TraceReconstructionFilter> { - - public final IInputPort<TraceReconstructionFilter, Long> timestampInputPort = this.createInputPort(); - public final IInputPort<TraceReconstructionFilter, IFlowRecord> recordInputPort = this.createInputPort(); - - public final IOutputPort<TraceReconstructionFilter, TraceEventRecords> traceInvalidOutputPort = this.createOutputPort(); - public final IOutputPort<TraceReconstructionFilter, TraceEventRecords> traceValidOutputPort = this.createOutputPort(); - - private TimeUnit timeunit; - private long maxTraceDuration; - private long maxTraceTimeout; - private boolean timeout; - private long maxEncounteredLoggingTimestamp = -1; - - private static final Map<Long, TraceBuffer> traceId2trace = new ConcurrentHashMapWithDefault<Long, TraceBuffer>(new TraceBuffer()); - - @Override - protected boolean execute(final Context<TraceReconstructionFilter> context) { - final Long timestamp = context.tryTake(this.timestampInputPort); - if (timestamp != null) { - if (this.timeout) { - this.processTimeoutQueue(timestamp, context); - } - return true; - } - - final IFlowRecord record = context.tryTake(this.recordInputPort); - if (record != null) { - final Long traceId = this.reconstructTrace(record); - if (traceId != null) { - this.putIfFinished(traceId, context); - this.processTimestamp(record, context); - } - return true; - } - - return false; - } - - private void processTimestamp(final IFlowRecord record, final Context<TraceReconstructionFilter> context) { - if (this.timeout) { - synchronized (this) { - final long loggingTimestamp = this.getTimestamp(record); - // can we assume a rough order of logging timestamps? (yes, except with DB reader) - if (loggingTimestamp > this.maxEncounteredLoggingTimestamp) { - this.maxEncounteredLoggingTimestamp = loggingTimestamp; - } - this.processTimeoutQueue(this.maxEncounteredLoggingTimestamp, context); - } - } - } - - private long getTimestamp(final IFlowRecord record) { - if (record instanceof AbstractTraceEvent) { - return ((AbstractTraceEvent) record).getTimestamp(); - } - return -1; - } - - private void putIfFinished(final Long traceId, final Context<TraceReconstructionFilter> context) { - final TraceBuffer traceBuffer = TraceReconstructionFilter.traceId2trace.get(traceId); - if (traceBuffer.isFinished()) { - synchronized (this) { // has to be synchronized because of timeout cleanup - TraceReconstructionFilter.traceId2trace.remove(traceId); - } - this.put(traceBuffer, context); - } - } - - private Long reconstructTrace(final IFlowRecord record) { - Long traceId = null; - if (record instanceof TraceMetadata) { - traceId = ((TraceMetadata) record).getTraceId(); - final TraceBuffer traceBuffer = TraceReconstructionFilter.traceId2trace.get(traceId); - - traceBuffer.setTrace((TraceMetadata) record); - } else if (record instanceof AbstractTraceEvent) { - traceId = ((AbstractTraceEvent) record).getTraceId(); - final TraceBuffer traceBuffer = TraceReconstructionFilter.traceId2trace.get(traceId); - - traceBuffer.insertEvent((AbstractTraceEvent) record); - } - - return traceId; - } - - @Override - public void onPipelineStarts() throws Exception { - this.timeout = !((this.maxTraceTimeout == Long.MAX_VALUE) && (this.maxTraceDuration == Long.MAX_VALUE)); - super.onPipelineStarts(); - } - - private void processTimeoutQueue(final long timestamp, final Context<TraceReconstructionFilter> context) { - final long duration = timestamp - this.maxTraceDuration; - final long traceTimeout = timestamp - this.maxTraceTimeout; - - for (final Iterator<Entry<Long, TraceBuffer>> iterator = TraceReconstructionFilter.traceId2trace.entrySet().iterator(); iterator.hasNext();) { - final TraceBuffer traceBuffer = iterator.next().getValue(); - if ((traceBuffer.getMaxLoggingTimestamp() <= traceTimeout) // long time no see - || (traceBuffer.getMinLoggingTimestamp() <= duration)) { // max duration is gone - this.put(traceBuffer, context); - iterator.remove(); - } - } - } - - private void put(final TraceBuffer traceBuffer, final Context<TraceReconstructionFilter> context) { - final IOutputPort<TraceReconstructionFilter, TraceEventRecords> outputPort = - (traceBuffer.isInvalid()) ? this.traceInvalidOutputPort : this.traceValidOutputPort; - context.put(outputPort, traceBuffer.toTraceEvents()); - } - - public TimeUnit getTimeunit() { - return this.timeunit; - } - - public void setTimeunit(final TimeUnit timeunit) { - this.timeunit = timeunit; - } - - public long getMaxTraceDuration() { - return this.maxTraceDuration; - } - - public void setMaxTraceDuration(final long maxTraceDuration) { - this.maxTraceDuration = maxTraceDuration; - } - - public long getMaxTraceTimeout() { - return this.maxTraceTimeout; - } - - public void setMaxTraceTimeout(final long maxTraceTimeout) { - this.maxTraceTimeout = maxTraceTimeout; - } - - public long getMaxEncounteredLoggingTimestamp() { - return this.maxEncounteredLoggingTimestamp; - } - - public void setMaxEncounteredLoggingTimestamp(final long maxEncounteredLoggingTimestamp) { - this.maxEncounteredLoggingTimestamp = maxEncounteredLoggingTimestamp; - } - - // public Map<Long, TraceBuffer> getTraceId2trace() { - // return TraceReconstructionFilter.traceId2trace; - // } - // - // public void setTraceId2trace(final Map<Long, TraceBuffer> traceId2trace) { - // TraceReconstructionFilter.traceId2trace = traceId2trace; - // } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/FileExtensionPredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/FileExtensionPredicate.java deleted file mode 100644 index 6ce007d3bd0d359a9fd2dd49ec1d1e9e27639b51..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/FileExtensionPredicate.java +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.io.File; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class FileExtensionPredicate implements Predicate<File> { - - private final String fileExtension; - - public FileExtensionPredicate(final String fileExtension) { - this.fileExtension = fileExtension; - } - - public boolean apply(final File file) { - return file.getName().endsWith(this.fileExtension); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsDirectoryPredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsDirectoryPredicate.java deleted file mode 100644 index fbb7b8172cf2fa228a51382031afa657e8bd1e6b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsDirectoryPredicate.java +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.io.File; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsDirectoryPredicate implements Predicate<File> { - - public boolean apply(final File file) { - return file.isDirectory(); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsIMonitoringRecordInRange.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsIMonitoringRecordInRange.java deleted file mode 100644 index b7f6f4648768a3ee88764b4419aff5fa46a62cdc..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsIMonitoringRecordInRange.java +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import kieker.common.record.IMonitoringRecord; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsIMonitoringRecordInRange extends IsTimestampInRange<IMonitoringRecord> { - - /** - * @since 1.10 - */ - public IsIMonitoringRecordInRange(final long min, final long max) { - super(min, max); - } - - public boolean apply(final IMonitoringRecord record) { - final long timestamp = record.getLoggingTimestamp(); - return this.isInRange(timestamp); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsInstanceOfPredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsInstanceOfPredicate.java deleted file mode 100644 index 828591d4e4c24201fb0a8a22b9e0c34666bb179d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsInstanceOfPredicate.java +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.util.Collection; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsInstanceOfPredicate<T> implements Predicate<T> { - - private final Collection<Class<?>> acceptedClasses; - - /** - * @since 1.10 - */ - public IsInstanceOfPredicate(final Collection<Class<?>> acceptedClasses) { - this.acceptedClasses = acceptedClasses; - } - - public boolean apply(final T object) { - for (final Class<?> acceptedClazz : this.acceptedClasses) { - if (acceptedClazz.isInstance(object)) { - return true; - } - } - return false; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordInRange.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordInRange.java deleted file mode 100644 index 06d6a2b58edab9611dbe41292ac81568472e3222..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordInRange.java +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import kieker.common.record.controlflow.OperationExecutionRecord; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsOperationExecutionRecordInRange extends IsTimestampInRange<OperationExecutionRecord> { - - /** - * @since 1.10 - */ - public IsOperationExecutionRecordInRange(final long min, final long max) { - super(min, max); - } - - public boolean apply(final OperationExecutionRecord record) { - final long tinTimestamp = record.getTin(); - final boolean isTinInRange = this.isInRange(tinTimestamp); - final long toutTimestamp = record.getTout(); - final boolean isToutInRange = this.isInRange(toutTimestamp); - return isTinInRange && isToutInRange; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordTraceIdPredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordTraceIdPredicate.java deleted file mode 100644 index f2b60961a6bc87da6d3d8ce50b7072311729fa7a..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsOperationExecutionRecordTraceIdPredicate.java +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.util.Set; - -import kieker.common.record.controlflow.OperationExecutionRecord; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsOperationExecutionRecordTraceIdPredicate extends IsTraceIdPredicate<OperationExecutionRecord> { - - /** - * @since 1.10 - */ - public IsOperationExecutionRecordTraceIdPredicate(final boolean acceptAllTraces, final Set<Long> selectedTraceIds) { - super(acceptAllTraces, selectedTraceIds); - } - - public boolean apply(final OperationExecutionRecord record) { - final Long traceId = record.getTraceId(); - return this.acceptId(traceId); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsSuperTypePredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsSuperTypePredicate.java deleted file mode 100644 index 3be61c143466ab64adf9a850ffe48a93cea8303c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsSuperTypePredicate.java +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.util.Collection; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IsSuperTypePredicate<T> implements Predicate<T> { - - private final Collection<Class<?>> acceptedClasses; - - /** - * @since 1.10 - */ - public IsSuperTypePredicate(final Collection<Class<?>> acceptedClasses) { - this.acceptedClasses = acceptedClasses; - } - - public boolean apply(final T object) { - for (final Class<?> acceptedClazz : this.acceptedClasses) { - if (acceptedClazz.isAssignableFrom(object.getClass())) { - return true; - } - } - return false; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTimestampInRange.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTimestampInRange.java deleted file mode 100644 index 53d715adda571a6eaefc5e5535b3c10cc33b233c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTimestampInRange.java +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public abstract class IsTimestampInRange<T> implements Predicate<T> { - - private final long min; - private final long max; - - /** - * @since 1.10 - */ - public IsTimestampInRange(final long min, final long max) { - this.min = min; - this.max = max; - } - - protected boolean isInRange(final long timestamp) { - return (timestamp >= this.min) && (timestamp <= this.max); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTraceIdPredicate.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTraceIdPredicate.java deleted file mode 100644 index 48f6f8c4f05a160a379db0ef9574e1e9718b4031..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/IsTraceIdPredicate.java +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import java.util.Set; - -import com.google.common.base.Predicate; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public abstract class IsTraceIdPredicate<T> implements Predicate<T> { - - private final boolean acceptAllTraces; - private final Set<Long> selectedTraceIds; - - /** - * @since 1.10 - */ - public IsTraceIdPredicate(final boolean acceptAllTraces, final Set<Long> selectedTraceIds) { - this.acceptAllTraces = acceptAllTraces; - this.selectedTraceIds = selectedTraceIds; - } - - protected final boolean acceptId(final Long traceId) { - return (this.acceptAllTraces || this.selectedTraceIds.contains(traceId)); - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/PredicateFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/predicate/PredicateFilter.java deleted file mode 100644 index 370bdc24ff9ad19bf3c27c01cafd814a53469954..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/predicate/PredicateFilter.java +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.predicate; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -import com.google.common.base.Predicate; - -/** - * @author Nils Christian Ehmke - * @param <T> - * - * @since 1.10 - */ -public class PredicateFilter<T> extends AbstractFilter<PredicateFilter<T>> { - - public final IInputPort<PredicateFilter<T>, T> inputPort = this.createInputPort(); - - public final IOutputPort<PredicateFilter<T>, T> matchingOutputPort = this.createOutputPort(); - public final IOutputPort<PredicateFilter<T>, T> mismatchingOutputPort = this.createOutputPort(); - - private Predicate<T> predicate; - - public PredicateFilter(final Predicate<T> predicate) { - this.setPredicate(predicate); - } - - public PredicateFilter() { - super(); - } - - public Predicate<T> getPredicate() { - return this.predicate; - } - - public void setPredicate(final Predicate<T> predicate) { - this.predicate = predicate; - } - - @Override - protected boolean execute(final Context<PredicateFilter<T>> context) { - final T inputObject = context.tryTake(this.inputPort); - if (inputObject == null) { - return false; - } - - if (this.predicate.apply(inputObject)) { - context.put(this.matchingOutputPort, inputObject); - } else { - context.put(this.mismatchingOutputPort, inputObject); - } - - return true; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/StringBufferFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/StringBufferFilter.java deleted file mode 100644 index 426de753c4ad87794b37239e663bff8ef37a457b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/StringBufferFilter.java +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.stringBuffer; - -import java.util.Collection; -import java.util.LinkedList; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; -import teetime.variant.explicitScheduling.stage.stringBuffer.handler.AbstractDataTypeHandler; -import teetime.variant.explicitScheduling.stage.stringBuffer.util.KiekerHashMap; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StringBufferFilter<T> extends AbstractFilter<StringBufferFilter<T>> { - - public final IInputPort<StringBufferFilter<T>, T> objectInputPort = this.createInputPort(); - - public final IOutputPort<StringBufferFilter<T>, T> objectOutputPort = this.createOutputPort(); - - // BETTER use a non shared data structure to avoid synchronization between threads - private KiekerHashMap kiekerHashMap = new KiekerHashMap(); - - private Collection<AbstractDataTypeHandler<?>> dataTypeHandlers = new LinkedList<AbstractDataTypeHandler<?>>(); - - @Override - protected boolean execute(final Context<StringBufferFilter<T>> context) { - final T object = context.tryTake(this.objectInputPort); - if (object == null) { - return false; - } - - final T returnedObject = this.handle(object); - context.put(this.objectOutputPort, returnedObject); - - return true; - } - - @Override - public void onPipelineStarts() throws Exception { - for (final AbstractDataTypeHandler<?> handler : this.dataTypeHandlers) { - handler.setLogger(this.logger); - handler.setStringRepository(this.kiekerHashMap); - } - super.onPipelineStarts(); - } - - private T handle(final T object) { - for (final AbstractDataTypeHandler<?> handler : this.dataTypeHandlers) { - if (handler.canHandle(object)) { - @SuppressWarnings("unchecked") - final T returnedObject = ((AbstractDataTypeHandler<T>) handler).handle(object); - return returnedObject; - } - } - return object; // else relay given object - } - - public KiekerHashMap getKiekerHashMap() { - return this.kiekerHashMap; - } - - public void setKiekerHashMap(final KiekerHashMap kiekerHashMap) { - this.kiekerHashMap = kiekerHashMap; - } - - public Collection<AbstractDataTypeHandler<?>> getDataTypeHandlers() { - return this.dataTypeHandlers; - } - - public void setDataTypeHandlers(final Collection<AbstractDataTypeHandler<?>> dataTypeHandlers) { - this.dataTypeHandlers = dataTypeHandlers; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/AbstractDataTypeHandler.java b/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/AbstractDataTypeHandler.java deleted file mode 100644 index bb0c2140fa5a9b4db0b97ae43a6ef06ee35b3c76..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/stringBuffer/handler/AbstractDataTypeHandler.java +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.stringBuffer.handler; - -import teetime.variant.explicitScheduling.stage.stringBuffer.util.KiekerHashMap; - -import kieker.common.logging.Log; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public abstract class AbstractDataTypeHandler<T> { - - protected Log logger; - protected KiekerHashMap stringRepository; - - /** - * @since 1.10 - */ - public abstract boolean canHandle(Object object); - - /** - * @since 1.10 - */ - public abstract T handle(T object); - - /** - * @since 1.10 - */ - public void setLogger(final Log logger) { - this.logger = logger; - } - - /** - * @since 1.10 - */ - public void setStringRepository(final KiekerHashMap stringRepository) { - this.stringRepository = stringRepository; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/throughput/AnalysisThroughputFilter.java b/src/main/java/teetime/variant/explicitScheduling/stage/throughput/AnalysisThroughputFilter.java deleted file mode 100644 index 5d3b66291fdacdb32579af4dd50bf8d3bb7cb6a3..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/throughput/AnalysisThroughputFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.throughput; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.framework.core.IOutputPort; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class AnalysisThroughputFilter<T> extends AbstractFilter<AnalysisThroughputFilter<T>> { - - public final IInputPort<AnalysisThroughputFilter<T>, T> objectInputPort = this.createInputPort(); - public final IInputPort<AnalysisThroughputFilter<T>, Long> timestampInputPort = this.createInputPort(); - - public final IOutputPort<AnalysisThroughputFilter<T>, T> objectOutputPort = this.createOutputPort(); - public final IOutputPort<AnalysisThroughputFilter<T>, ThroughputAnalysisResult> analysisOutputPort = this.createOutputPort(); - - private long lastTimestampInNs; - private int numObjectsPassed; - - @Override - protected boolean execute(final Context<AnalysisThroughputFilter<T>> context) { - final Long timestampInNs = context.tryTake(this.timestampInputPort); - if (timestampInNs == null) { - final T object = context.tryTake(this.objectInputPort); - context.put(this.objectOutputPort, object); - this.numObjectsPassed++; - } else { - final long durationInNs = timestampInNs - this.lastTimestampInNs; - context.put(this.analysisOutputPort, new ThroughputAnalysisResult(durationInNs, this.numObjectsPassed)); - this.reset(timestampInNs); - } - - return true; - } - - private void reset(final Long timestampInNs) { - this.numObjectsPassed = 0; - this.lastTimestampInNs = timestampInNs; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/throughput/ThroughputAnalysisResult.java b/src/main/java/teetime/variant/explicitScheduling/stage/throughput/ThroughputAnalysisResult.java deleted file mode 100644 index 147aec0c369fc1d6b02317ee56d0b9f0f0cd029e..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/throughput/ThroughputAnalysisResult.java +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.throughput; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ThroughputAnalysisResult { - - private final long durationInNs; - private final int numObjectsPassed; - - /** - * @since 1.10 - */ - public ThroughputAnalysisResult(final long durationInNs, final int numObjectsPassed) { - this.durationInNs = durationInNs; - this.numObjectsPassed = numObjectsPassed; - } - - public long getDurationInNs() { - return durationInNs; - } - - public int getNumObjectsPassed() { - return numObjectsPassed; - } - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/visualization/IWebVisualizationSink.java b/src/main/java/teetime/variant/explicitScheduling/stage/visualization/IWebVisualizationSink.java deleted file mode 100644 index fe1fad49c4b1b53ca57d20a01ada01fad535127c..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/visualization/IWebVisualizationSink.java +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.visualization; - -/** - * @author Nils Christian Ehmke - * - * @since 1.10 - * - * @param <I> - * The type of the input ports - */ -public interface IWebVisualizationSink { - - public String getHeader(); - - public String getInitialContent(); - - public String getUpdatedContent(); - -} diff --git a/src/main/java/teetime/variant/explicitScheduling/stage/visualization/PlainTextWebVisualizationSink.java b/src/main/java/teetime/variant/explicitScheduling/stage/visualization/PlainTextWebVisualizationSink.java deleted file mode 100644 index dea77fb4f8bee974a6065c0c50920337a780ec1a..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/explicitScheduling/stage/visualization/PlainTextWebVisualizationSink.java +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.stage.visualization; - -import teetime.variant.explicitScheduling.framework.core.AbstractFilter; -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; - -/** - * @author Nils Christian Ehmke, Christian Wulf - * - * @since 1.10 - * - * @param <I> - * The type of the input ports - */ -public class PlainTextWebVisualizationSink<T> extends AbstractFilter<PlainTextWebVisualizationSink<T>> implements IWebVisualizationSink { - - public final IInputPort<PlainTextWebVisualizationSink<T>, T> INPUT_OBJECT = this.createInputPort(); - - private Object currentObject = "N/A"; - - /** - * @since 1.10 - */ - public String getHeader() { - return ""; - } - - /** - * @since 1.10 - */ - public String getInitialContent() { - return this.currentObject.toString(); - } - - /** - * @since 1.10 - */ - public String getUpdatedContent() { - return this.currentObject.toString(); - } - - /** - * @since 1.10 - */ - @Override - protected boolean execute(final Context<PlainTextWebVisualizationSink<T>> context) { - final T object = context.tryTake(this.INPUT_OBJECT); - if (object == null) { - return false; - } - - this.currentObject = object; - - return true; - } - -} diff --git a/src/main/java/teetime/variant/methodcall/framework/core/AbstractStage.java b/src/main/java/teetime/variant/methodcall/framework/core/AbstractStage.java deleted file mode 100644 index 1d55b0bac70b1e9056064ce16d898d962b97af3b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/framework/core/AbstractStage.java +++ /dev/null @@ -1,96 +0,0 @@ -package teetime.variant.methodcall.framework.core; - -import teetime.util.list.CommittableQueue; -import teetime.util.list.CommittableResizableArrayQueue; - -public abstract class AbstractStage<I, O> implements Stage<I, O> { - - protected final CommittableQueue<O> outputElements = new CommittableResizableArrayQueue<O>(null, 4); - - private Stage<?, ?> parentStage; - - private Stage<?, ?> successor; - - private boolean reschedulable; - - @Override - public Object executeRecursively(final Object element) { - O result = this.execute(element); - if (result == null) { - return null; - } - Stage<?, ?> next = this.next(); - // if (next != null) { - // return next.executeRecursively(result); - // } else { - // return result; - // } - return next.executeRecursively(result); - } - - @Override - public CommittableQueue<O> execute2(final CommittableQueue<I> elements) { - // pass through the end signal - // InputPort<I> port = this.getInputPort(); - // if (elements != null) { - // // I element = port.read(); - // // I element = elements.getTail(); - // // if (element == END_SIGNAL) { - // // this.send((O) END_SIGNAL); - // // } else { - // // // elements = this.getInputPort().pipe.getElements(); - // // } - // - // this.execute4(elements); - // } else { - // throw new IllegalStateException(); - // } - - this.execute4(elements); - - this.outputElements.commit(); - - return this.outputElements; - } - - protected abstract void execute4(CommittableQueue<I> elements); - - protected void send(final O element) { - this.outputElements.addToTailUncommitted(element); - } - - @Override - public void onStart() { - // empty default implementation - } - - @Override - public Stage<?, ?> getParentStage() { - return this.parentStage; - } - - @Override - public void setParentStage(final Stage<?, ?> parentStage, final int index) { - this.parentStage = parentStage; - } - - @Override - public Stage<?, ?> next() { - return this.successor; - } - - @Override - public void setSuccessor(final Stage<? super O, ?> successor) { - this.successor = successor; - } - - @Override - public boolean isReschedulable() { - return this.reschedulable; - } - - public void setReschedulable(final boolean reschedulable) { - this.reschedulable = reschedulable; - } - -} diff --git a/src/main/java/teetime/variant/methodcall/framework/core/ConsumerStage.java b/src/main/java/teetime/variant/methodcall/framework/core/ConsumerStage.java deleted file mode 100644 index 2ea5b659ea079ac7fd240bcd0952358596f44e20..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/framework/core/ConsumerStage.java +++ /dev/null @@ -1,26 +0,0 @@ -package teetime.variant.methodcall.framework.core; - -import teetime.util.list.CommittableQueue; - -public abstract class ConsumerStage<I, O> extends AbstractStage<I, O> { - - @Override - public CommittableQueue<O> execute2(final CommittableQueue<I> elements) { - // the following code block does not harm the performance - // boolean inputIsEmpty = elements.isEmpty(); - // if (inputIsEmpty) { - // this.disable(); - // return this.outputElements; - // } - - CommittableQueue<O> output = super.execute2(elements); - this.setReschedulable(!elements.isEmpty()); // costs ~1200 ns on chw-work (not reproducible) - return output; - } - - @Override - public void onIsPipelineHead() { - // do nothing - } - -} diff --git a/src/main/java/teetime/variant/methodcall/framework/core/Pipeline.java b/src/main/java/teetime/variant/methodcall/framework/core/Pipeline.java deleted file mode 100644 index 6934bf29114678233bf3f794a43aa2cc3d482faa..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/framework/core/Pipeline.java +++ /dev/null @@ -1,160 +0,0 @@ -package teetime.variant.methodcall.framework.core; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import teetime.util.list.CommittableQueue; -import teetime.variant.methodcall.stage.EndStage; - -public class Pipeline<I, O> implements Stage<I, O> { - - private Stage<I, ?> firstStage; - private final List<Stage<?, ?>> intermediateStages = new LinkedList<Stage<?, ?>>(); - private Stage<?, O> lastStage; - - private Stage<?, ?>[] stages; - private Stage<?, ?> parentStage; - private int index; - - private boolean reschedulable; - - public void setFirstStage(final Stage<I, ?> stage) { - this.firstStage = stage; - } - - public void addIntermediateStages(final Stage<?, ?>... stages) { - this.intermediateStages.addAll(Arrays.asList(stages)); - } - - public void addIntermediateStage(final Stage<?, ?> stage) { - this.intermediateStages.add(stage); - } - - public void setLastStage(final Stage<?, O> stage) { - this.lastStage = stage; - } - - @SuppressWarnings("unchecked") - @Override - public CommittableQueue<O> execute2(final CommittableQueue<I> elements) { - // CommittableQueue queue = this.firstStage.execute2(elements); - // for (Stage<?, ?> stage : this.intermediateStages) { - // queue = stage.execute2(queue); - // } - // return this.lastStage.execute2(queue); - - // below is faster than above (probably because of the instantiation of a list iterator in each (!) execution) - @SuppressWarnings("rawtypes") - CommittableQueue queue = elements; - - for (int i = 0; i < this.stages.length; i++) { - Stage<?, ?> stage = this.stages[i]; - queue = stage.execute2(queue); - if (queue.isEmpty()) { - break; - } - } - - // queue = this.firstStage.execute2(elements); - - this.setReschedulable(this.firstStage.isReschedulable()); - - return queue; - } - - @Override - public void onIsPipelineHead() { - // do nothing - } - - @Override - public Object executeRecursively(final Object element) { - return this.firstStage.executeRecursively(element); - } - - @Override - public void onStart() { - // Pipe pipe = new Pipe(); - // this.outputPort.pipe = pipe; - // this.firstStage.getInputPort().pipe = pipe; - - // Pipe pipe = new Pipe(); - // this.firstStage.getOutputPort().pipe = pipe; - // this.intermediateStages.get(0).getInputPort().pipe = pipe; - // - // for (int i = 0; i < this.intermediateStages.size() - 1; i++) { - // Stage left = this.intermediateStages.get(i); - // Stage right = this.intermediateStages.get(i + 1); - // - // pipe = new Pipe(); - // left.getOutputPort().pipe = pipe; - // right.getInputPort().pipe = pipe; - // } - // - // pipe = new Pipe(); - // this.intermediateStages.get(this.intermediateStages.size() - 1).getOutputPort().pipe = pipe; - // this.lastStage.getInputPort().pipe = pipe; - - int size = 1 + this.intermediateStages.size() + 1; - this.stages = new Stage[size]; - this.stages[0] = this.firstStage; - for (int i = 0; i < this.intermediateStages.size(); i++) { - Stage<?, ?> stage = this.intermediateStages.get(i); - this.stages[1 + i] = stage; - } - this.stages[this.stages.length - 1] = this.lastStage; - - for (int i = 0; i < this.stages.length; i++) { - // Stage<?, ?> stage = this.stages[i]; - // stage.setParentStage(this, i); - // stage.setListener(this); - } - - for (int i = 0; i < this.stages.length - 1; i++) { - Stage stage = this.stages[i]; - stage.setSuccessor(this.stages[i + 1]); - } - this.stages[this.stages.length - 1].setSuccessor(new EndStage<Object>()); - - for (Stage<?, ?> stage : this.stages) { - stage.onStart(); - } - } - - @Override - public Stage<?, ?> getParentStage() { - return this.parentStage; - } - - @Override - public void setParentStage(final Stage<?, ?> parentStage, final int index) { - this.index = index; - this.parentStage = parentStage; - } - - @Override - public O execute(final Object element) { - throw new IllegalStateException(); - } - - @Override - public Stage next() { - throw new IllegalStateException(); - } - - @Override - public void setSuccessor(final Stage<? super O, ?> successor) { - throw new IllegalStateException(); - } - - public void setReschedulable(final boolean reschedulable) { - this.reschedulable = reschedulable; - } - - @Override - public boolean isReschedulable() { - return this.reschedulable; - } - -} diff --git a/src/main/java/teetime/variant/methodcall/framework/core/ProducerStage.java b/src/main/java/teetime/variant/methodcall/framework/core/ProducerStage.java deleted file mode 100644 index bd7707bee1b50089cc5b03f2838bfc86d4cf97b4..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/framework/core/ProducerStage.java +++ /dev/null @@ -1,28 +0,0 @@ -package teetime.variant.methodcall.framework.core; - -import teetime.util.list.CommittableQueue; - -public abstract class ProducerStage<I, O> extends AbstractStage<I, O> { - - public ProducerStage() { - this.setReschedulable(true); - } - - @Override - public CommittableQueue<O> execute2(final CommittableQueue<I> elements) { - CommittableQueue<O> outputElements = super.execute2(elements); - - boolean outputIsEmpty = outputElements.isEmpty(); - if (outputIsEmpty) { - // this.getOutputPort().getPipe().close(); - } - - return outputElements; - } - - @Override - public void onIsPipelineHead() { - // do nothing - } - -} diff --git a/src/main/java/teetime/variant/methodcall/framework/core/Stage.java b/src/main/java/teetime/variant/methodcall/framework/core/Stage.java deleted file mode 100644 index 2ab689b1869ac2c02f801a9de6f70861a29ccadb..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/framework/core/Stage.java +++ /dev/null @@ -1,38 +0,0 @@ -package teetime.variant.methodcall.framework.core; - -import teetime.util.list.CommittableQueue; - -public interface Stage<I, O> { - - Object executeRecursively(Object element); - - O execute(Object element); - - // CommittableQueue<O> execute2(); - - CommittableQueue<O> execute2(CommittableQueue<I> elements); - - // SchedulingInformation getSchedulingInformation(); - - Stage<?, ?> getParentStage(); - - void setParentStage(Stage<?, ?> parentStage, int index); - - // void setListener(OnDisableListener listener); - - Stage<?, ?> next(); - - void setSuccessor(Stage<? super O, ?> successor); - - /** - * Used for execute4() (experiment02) - * - * @return - */ - boolean isReschedulable(); - - void onIsPipelineHead(); - - void onStart(); - -} diff --git a/src/main/java/teetime/variant/methodcall/stage/CollectorSink.java b/src/main/java/teetime/variant/methodcall/stage/CollectorSink.java deleted file mode 100644 index 1b2a8d3feb4886b8999571d9e77e4d78fccf4754..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/CollectorSink.java +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.stage; - -import java.util.List; - -import teetime.util.list.CommittableQueue; -import teetime.variant.methodcall.framework.core.ConsumerStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class CollectorSink<T> extends ConsumerStage<T, Object> { - - private static final int THRESHOLD = 10000; - private static final Object continueSignal = new Object(); - - private final List<T> elements; - - public CollectorSink(final List<T> list) { - this.elements = list; - } - - @SuppressWarnings("unchecked") - @Override - public Object execute(final Object element) { - this.elements.add((T) element); - if ((this.elements.size() % THRESHOLD) == 0) { - System.out.println("size: " + this.elements.size()); - } - return continueSignal; - } - - @Override - public void onIsPipelineHead() { - System.out.println("size: " + this.elements.size()); - } - - @Override - protected void execute4(final CommittableQueue<T> elements) { - T element = elements.removeFromHead(); - this.elements.add(element); - if ((this.elements.size() % THRESHOLD) == 0) { - System.out.println("size: " + this.elements.size()); - } - } - -} diff --git a/src/main/java/teetime/variant/methodcall/stage/EndStage.java b/src/main/java/teetime/variant/methodcall/stage/EndStage.java deleted file mode 100644 index eccd922a682a1207341d243e2d753edf90effdbb..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/EndStage.java +++ /dev/null @@ -1,71 +0,0 @@ -package teetime.variant.methodcall.stage; - -import java.util.LinkedList; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.util.list.CommittableQueue; -import teetime.variant.methodcall.framework.core.Stage; - -public class EndStage<T> implements Stage<T, T> { - - public int count; - public ConstructorClosure<?> closure; - public List<Object> list = new LinkedList<Object>(); - - @Override - public T execute(final Object element) { - throw new IllegalStateException(); - } - - @Override - public void onIsPipelineHead() { - // do nothing - } - - @Override - public CommittableQueue<T> execute2(final CommittableQueue<T> elements) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Stage getParentStage() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setParentStage(final Stage<?, ?> parentStage, final int index) { - // TODO Auto-generated method stub - - } - - @Override - public Stage next() { - return null; - } - - @Override - public void setSuccessor(final Stage<? super T, ?> successor) { - // TODO Auto-generated method stub - - } - - @Override - public void onStart() { - // TODO Auto-generated method stub - - } - - @Override - public Object executeRecursively(final Object element) { - return element; - } - - @Override - public boolean isReschedulable() { - return false; - } - -} diff --git a/src/main/java/teetime/variant/methodcall/stage/NoopFilter.java b/src/main/java/teetime/variant/methodcall/stage/NoopFilter.java deleted file mode 100644 index 5907267c5a331518c3d23bba80282b748b0af3b6..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/NoopFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.stage; - -import teetime.util.list.CommittableQueue; -import teetime.variant.methodcall.framework.core.ConsumerStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class NoopFilter<T> extends ConsumerStage<T, T> { - - @SuppressWarnings("unchecked") - @Override - public T execute(final Object obj) { - return (T) obj; - } - - @Override - protected void execute4(final CommittableQueue<T> elements) { - T element = elements.removeFromHead(); - this.send(element); // TODO ? "send" calls the next stage and so on - } - -} diff --git a/src/main/java/teetime/variant/methodcall/stage/ObjectProducer.java b/src/main/java/teetime/variant/methodcall/stage/ObjectProducer.java deleted file mode 100644 index 1d580d362ae1f457f7912ec0ac9273993cb47d88..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/ObjectProducer.java +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.stage; - -import teetime.util.ConstructorClosure; -import teetime.util.list.CommittableQueue; -import teetime.variant.methodcall.framework.core.ProducerStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ObjectProducer<T> extends ProducerStage<Void, T> { - - private long numInputObjects; - private ConstructorClosure<T> inputObjectCreator; - - /** - * @since 1.10 - */ - public ObjectProducer(final long numInputObjects, final ConstructorClosure<T> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - @Override - public T execute(final Object element) { - if (this.numInputObjects == 0) { - return null; - } - - try { - final T newObject = this.inputObjectCreator.create(); - // final T newObject = null; - this.numInputObjects--; - - return newObject; - } catch (final Exception e) { - throw new IllegalStateException(e); - } - } - - public long getNumInputObjects() { - return this.numInputObjects; - } - - public void setNumInputObjects(final long numInputObjects) { - this.numInputObjects = numInputObjects; - } - - public ConstructorClosure<T> getInputObjectCreator() { - return this.inputObjectCreator; - } - - public void setInputObjectCreator(final ConstructorClosure<T> inputObjectCreator) { - this.inputObjectCreator = inputObjectCreator; - } - - @Override - protected void execute4(final CommittableQueue<Void> elements) { - if (this.numInputObjects == 0) { - this.setReschedulable(false); - // this.getOutputPort().pipe.close(); - return; - } - - T newObject = null; - newObject = this.inputObjectCreator.create(); - this.numInputObjects--; - - // System.out.println(this.getClass().getSimpleName() + ": sending " + this.numInputObjects); - this.send(newObject); - // throw new IllegalStateException(); - } - -} diff --git a/src/main/java/teetime/variant/methodcall/stage/StartTimestampFilter.java b/src/main/java/teetime/variant/methodcall/stage/StartTimestampFilter.java deleted file mode 100644 index a83d1655af9cffcd5c30ab8100b48de0e1733d52..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/StartTimestampFilter.java +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.stage; - -import teetime.util.list.CommittableQueue; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.methodcall.framework.core.ConsumerStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StartTimestampFilter extends ConsumerStage<TimestampObject, TimestampObject> { - - @Override - public TimestampObject execute(final Object obj) { - TimestampObject timestampObject = (TimestampObject) obj; - timestampObject.setStartTimestamp(System.nanoTime()); - return timestampObject; - } - - @Override - protected void execute4(final CommittableQueue<TimestampObject> elements) { - TimestampObject element = elements.removeFromHead(); - element.setStartTimestamp(System.nanoTime()); - this.send(element); - } -} diff --git a/src/main/java/teetime/variant/methodcall/stage/StopTimestampFilter.java b/src/main/java/teetime/variant/methodcall/stage/StopTimestampFilter.java deleted file mode 100644 index 1e36f5337346113c8f42036985e3e69287b4cb99..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcall/stage/StopTimestampFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.stage; - -import teetime.util.list.CommittableQueue; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.methodcall.framework.core.ConsumerStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StopTimestampFilter extends ConsumerStage<TimestampObject, TimestampObject> { - - @Override - public TimestampObject execute(final Object obj) { - TimestampObject timestampObject = (TimestampObject) obj; - timestampObject.setStopTimestamp(System.nanoTime()); - return timestampObject; - } - - @Override - protected void execute4(final CommittableQueue<TimestampObject> elements) { - TimestampObject element = elements.removeFromHead(); - element.setStopTimestamp(System.nanoTime()); - this.send(element); - } - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/SysOutFilter.java b/src/main/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/SysOutFilter.java deleted file mode 100644 index 7b97e682bf260cd0ffd8d585c8602aa7f947ba37..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/SysOutFilter.java +++ /dev/null @@ -1,33 +0,0 @@ -package teetime.variant.methodcallWithPorts.examples.traceReconstructionWithThreads; - -import teetime.variant.methodcallWithPorts.framework.core.ConsumerStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; - -public class SysOutFilter<T> extends ConsumerStage<T> { - - private final InputPort<Long> triggerInputPort = this.createInputPort(); - private final OutputPort<T> outputPort = this.createOutputPort(); - - private final IPipe pipe; - - public SysOutFilter(final IPipe pipe) { - this.pipe = pipe; - } - - @Override - protected void execute(final T element) { - Long timestamp = this.triggerInputPort.receive(); - if (timestamp != null) { - // this.logger.info("pipe.size: " + this.pipe.size()); - System.out.println("pipe.size: " + this.pipe.size()); - } - this.send(this.outputPort, element); - } - - public InputPort<Long> getTriggerInputPort() { - return this.triggerInputPort; - } - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipeFactory.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipeFactory.java deleted file mode 100644 index da4bbd44d6f4f3f7eb2c361eae579a92f296949f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/pipe/IPipeFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -package teetime.variant.methodcallWithPorts.framework.core.pipe; - -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; - -public interface IPipeFactory { - - @Deprecated - IPipe create(int capacity); - - <T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort); - - <T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort, int capacity); - - ThreadCommunication getThreadCommunication(); - - PipeOrdering getOrdering(); - - boolean isGrowable(); - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ISignal.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ISignal.java deleted file mode 100644 index 13e15dbf29069d24ee577b89522540836122699b..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/signal/ISignal.java +++ /dev/null @@ -1,8 +0,0 @@ -package teetime.variant.methodcallWithPorts.framework.core.signal; - -import teetime.variant.methodcallWithPorts.framework.core.AbstractStage; - -public interface ISignal { - - void trigger(AbstractStage stage); -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/MonitoringLogDirectory2Files.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/MonitoringLogDirectory2Files.java deleted file mode 100644 index d420b145eb6f92e2764112afb6654dc5f09c79ad..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/MonitoringLogDirectory2Files.java +++ /dev/null @@ -1,88 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.kieker; - -import java.io.File; -import java.io.FileFilter; -import java.util.Comparator; - -import kieker.common.util.filesystem.BinaryCompressionMethod; -import kieker.common.util.filesystem.FSUtil; - -import teetime.variant.explicitScheduling.framework.core.Context; -import teetime.variant.explicitScheduling.framework.core.IInputPort; -import teetime.variant.explicitScheduling.stage.io.Directory2FilesFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MonitoringLogDirectory2Files extends Directory2FilesFilter { - - public final IInputPort<Directory2FilesFilter, String> filePrefixInputPort = this.createInputPort(); - - /** - * @author Christian Wulf - * - * @since 1.10 - */ - static class MonitoringLogFileFilter implements FileFilter { - private String filePrefix; - - @Override - public boolean accept(final File pathname) { - final String name = pathname.getName(); - return pathname.isFile() - && name.startsWith(this.filePrefix) - && (name.endsWith(FSUtil.NORMAL_FILE_EXTENSION) || BinaryCompressionMethod.hasValidFileExtension(name)); - } - - public String getFilePrefix() { - return this.filePrefix; - } - - public void setFilePrefix(final String filePrefix) { - this.filePrefix = filePrefix; - } - } - - private static final Comparator<File> FILE_COMPARATOR = new Comparator<File>() { - @Override - public final int compare(final File f1, final File f2) { - return f1.compareTo(f2); // simplified (we expect no dirs!) - } - }; - - /** - * @since 1.10 - */ - public MonitoringLogDirectory2Files() { - super(new MonitoringLogFileFilter(), FILE_COMPARATOR); - } - - @Override - protected boolean execute(final Context<Directory2FilesFilter> context) { - final String filePrefix = context.tryTake(this.filePrefixInputPort); - if (filePrefix == null) { - return false; - } - - ((MonitoringLogFileFilter) this.getFilter()).setFilePrefix(filePrefix); - - return super.execute(context); - } -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistry.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistry.java deleted file mode 100644 index 3afc8cb84009b59d475ae9bfdeffe8b4e3c57701..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistry.java +++ /dev/null @@ -1,29 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.kieker.className; - -import java.util.HashMap; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ClassNameRegistry extends HashMap<Integer, String> { - - private static final long serialVersionUID = -7254550212115937463L; - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryRepository.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryRepository.java deleted file mode 100644 index e916721a3c16e68cd09fb59f458bbcc1daa859e2..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/className/ClassNameRegistryRepository.java +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.kieker.className; - -import java.io.File; -import java.util.concurrent.ConcurrentHashMap; - -/** - * This class represents a wrapper for a Map<String, ClassNameRegistry> ensuring that keys are - * <ul> - * <li>of the type <code>java.io.File</code> and - * <li>passed as absolute file paths. - * </ul> - * - * @author Christian Wulf - * - * @since 1.10 - */ -public class ClassNameRegistryRepository { - - private final ConcurrentHashMap<String, ClassNameRegistry> classNameRegistryRepository = new ConcurrentHashMap<String, ClassNameRegistry>(); - - /** - * @since 1.10 - */ - public ClassNameRegistry get(final File directory) { - return this.classNameRegistryRepository.get(directory.getAbsolutePath()); - } - - /** - * @since 1.10 - */ - public void put(final File directory, final ClassNameRegistry classNameRegistry) { - this.classNameRegistryRepository.put(directory.getAbsolutePath(), classNameRegistry); - } - - /** - * @since 1.10 - */ - public int size() { - return this.classNameRegistryRepository.size(); - } - - @Override - public String toString() { - return this.classNameRegistryRepository.toString(); - } -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromTextLineCreator.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromTextLineCreator.java deleted file mode 100644 index 476a753751d51945033bb6e0ef3ae255fd44c53f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/kieker/fileToRecord/RecordFromTextLineCreator.java +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.kieker.fileToRecord; - -import java.io.File; - -import teetime.variant.explicitScheduling.stage.MappingException; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistry; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; - -import kieker.common.exception.IllegalRecordFormatException; -import kieker.common.exception.MonitoringRecordException; -import kieker.common.exception.UnknownRecordTypeException; -import kieker.common.record.AbstractMonitoringRecord; -import kieker.common.record.IMonitoringRecord; -import kieker.common.record.controlflow.OperationExecutionRecord; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class RecordFromTextLineCreator { - - private static final String CSV_SEPARATOR_CHARACTER = ";"; - - private static final IllegalRecordFormatException ILLEGAL_RECORD_FORMAT_EXCEPTION = new IllegalRecordFormatException(); - - private final ClassNameRegistryRepository classNameRegistryRepository; - - public RecordFromTextLineCreator(final ClassNameRegistryRepository classNameRegistryRepository) { - this.classNameRegistryRepository = classNameRegistryRepository; - } - - /** - * @since 1.10 - */ - public IMonitoringRecord createRecordFromLine(final File textFile, final String line) throws MonitoringRecordException, IllegalRecordFormatException, - MappingException, - UnknownRecordTypeException { - final String[] recordFields = line.split(CSV_SEPARATOR_CHARACTER); - - if (recordFields.length < 2) { - throw ILLEGAL_RECORD_FORMAT_EXCEPTION; - } - - final boolean isModernRecord = recordFields[0].charAt(0) == '$'; - if (isModernRecord) { - return this.createModernRecordFromRecordFields(textFile, recordFields); - } else { - return this.createLegacyRecordFromRecordFiels(recordFields); - } - } - - private IMonitoringRecord createModernRecordFromRecordFields(final File textFile, final String[] recordFields) throws MonitoringRecordException, - MappingException, - UnknownRecordTypeException { - final ClassNameRegistry classNameRegistry = this.classNameRegistryRepository.get(textFile.getParentFile()); - final Integer id = Integer.valueOf(recordFields[0].substring(1)); - final String classname = classNameRegistry.get(id); - if (classname == null) { - throw new MappingException("Missing classname mapping for record type id " + "'" + id + "'"); - } - final Class<? extends IMonitoringRecord> clazz = this.getClassByName(classname); - final long loggingTimestamp = Long.parseLong(recordFields[1]); - final int skipValues; - // check for Kieker < 1.6 OperationExecutionRecords - if ((recordFields.length == 11) && clazz.equals(OperationExecutionRecord.class)) { - skipValues = 3; - } else { - skipValues = 2; - } - // Java 1.5 compatibility - final String[] recordFieldsReduced = new String[recordFields.length - skipValues]; - System.arraycopy(recordFields, skipValues, recordFieldsReduced, 0, recordFields.length - skipValues); - // in Java 1.6 this could be simplified to - // recordFieldsReduced = Arrays.copyOfRange(recordFields, skipValues, recordFields.length); - - final IMonitoringRecord record = AbstractMonitoringRecord.createFromStringArray(clazz, recordFieldsReduced); - record.setLoggingTimestamp(loggingTimestamp); - return record; - } - - /** - * @since 1.10 - */ - private Class<? extends IMonitoringRecord> getClassByName(final String classname) throws MonitoringRecordException, UnknownRecordTypeException { - try { - return AbstractMonitoringRecord.classForName(classname); - } catch (final MonitoringRecordException ex) { - throw new UnknownRecordTypeException("Failed to load record type " + classname, classname, ex); - } - } - - /** - * @since 1.10 - */ - private IMonitoringRecord createLegacyRecordFromRecordFiels(final String[] recordFields) throws MonitoringRecordException { - final String[] recordFieldsReduced = new String[recordFields.length - 1]; - System.arraycopy(recordFields, 1, recordFieldsReduced, 0, recordFields.length - 1); - return AbstractMonitoringRecord.createFromStringArray(OperationExecutionRecord.class, recordFieldsReduced); - } -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/IMonitoringRecordHandler.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/IMonitoringRecordHandler.java deleted file mode 100644 index 554268dd70ac0e814a35b67af5dfbdffddb265f0..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/IMonitoringRecordHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.stringBuffer.handler; - -import kieker.common.exception.MonitoringRecordException; -import kieker.common.record.AbstractMonitoringRecord; -import kieker.common.record.IMonitoringRecord; - - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class IMonitoringRecordHandler extends AbstractDataTypeHandler<IMonitoringRecord> { - - @Override - public boolean canHandle(final Object object) { - return object instanceof IMonitoringRecord; - } - - @Override - public IMonitoringRecord handle(final IMonitoringRecord monitoringRecord) { - final Object[] objects = monitoringRecord.toArray(); - - boolean stringBuffered = false; - for (int i = 0; i < objects.length; i++) { - if (objects[i] instanceof String) { - objects[i] = this.stringRepository.get((String) objects[i]); - stringBuffered = true; - } - } - - if (stringBuffered) { - try { - final IMonitoringRecord newRecord = AbstractMonitoringRecord.createFromArray(monitoringRecord.getClass(), objects); - newRecord.setLoggingTimestamp(monitoringRecord.getLoggingTimestamp()); - return newRecord; - } catch (final MonitoringRecordException ex) { - this.logger.warn("Failed to recreate buffered monitoring record: " + monitoringRecord.toString(), ex); - } - } - - return monitoringRecord; - } - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/StringHandler.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/StringHandler.java deleted file mode 100644 index 54d133ab756e4518e059dd9b1acdaa1393d1e78f..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/handler/StringHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.stringBuffer.handler; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StringHandler extends AbstractDataTypeHandler<String> { - - @Override - public boolean canHandle(final Object object) { - return object instanceof String; - } - - @Override - public String handle(final String object) { - return this.stringRepository.get(object); - } - -} diff --git a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/util/KiekerHashMap.java b/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/util/KiekerHashMap.java deleted file mode 100644 index 76f7975686aa1f026df6c394fb08fa26a6a410a0..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/variant/methodcallWithPorts/stage/stringBuffer/util/KiekerHashMap.java +++ /dev/null @@ -1,291 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcallWithPorts.stage.stringBuffer.util; - -import java.lang.ref.SoftReference; -import java.util.concurrent.locks.ReentrantLock; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class KiekerHashMap { - - private static final int INITIAL_CAPACITY = 16; - private static final double LOAD_FACTOR = 0.75d; - private static final int CONCURRENCY_LEVEL = 16; - private static final int MAXIMUM_CAPACITY = 1 << 30; - - /** - * Mask value for indexing into segments. The upper bits of a key's hash code are used to choose the segment. - */ - private final int segmentMask; - - /** - * Shift value for indexing within segments. - */ - private final int segmentShift; - - /** - * The segments, each of which is a specialized hash table. - */ - private final Segment[] segments; - - /** - * @since 1.10 - */ - public KiekerHashMap() { - // Find power-of-two sizes best matching arguments - int sshift = 0; - int ssize = 1; - while (ssize < CONCURRENCY_LEVEL) { - ++sshift; - ssize <<= 1; - } - this.segmentShift = 32 - sshift; - this.segmentMask = ssize - 1; - this.segments = new Segment[ssize]; - int c = INITIAL_CAPACITY / ssize; - if ((c * ssize) < INITIAL_CAPACITY) { - ++c; - } - int cap = 1; - while (cap < c) { - cap <<= 1; - } - for (int i = 0; i < this.segments.length; ++i) { - this.segments[i] = new Segment(cap, LOAD_FACTOR); - } - } - - /** - * Applies a supplemental hash function to a given hashCode, which defends against poor quality hash functions. This is critical because ConcurrentHashMap uses - * power-of-two length hash tables, that otherwise encounter collisions for hashCodes that do not differ in lower or upper bits. - */ - private static final int hash(final String value) { - // Spread bits to regularize both segment and index locations, using variant of single-word Wang/Jenkins hash. - int h = value.hashCode(); - h += (h << 15) ^ 0xffffcd7d; - h ^= h >>> 10; - h += h << 3; - h ^= h >>> 6; - h += (h << 2) + (h << 14); - return h ^ (h >>> 16); - } - - public final String get(final String value) { - final int hash = KiekerHashMap.hash(value); - Segment segment = this.segments[(hash >>> this.segmentShift) & this.segmentMask]; - return segment.get(value, hash); - } - - // ---------------- Inner Classes -------------- - - /** - * StringBuffer entry. - */ - private static final class HashEntry extends SoftReference<String> { - final int hash; // NOPMD NOCS (package visible for inner class) - final HashEntry next; // NOPMD NOCS (package visible for inner class) - - protected HashEntry(final String value, final int hash, final HashEntry next) { - super(value); - this.hash = hash; - this.next = next; - } - } - - /** - * Segments are specialized versions of hash tables. This subclasses from ReentrantLock opportunistically, just to simplify some locking and avoid separate - * construction. - * - * Segments maintain a table of entry lists that are ALWAYS kept in a consistent state, so can be read without locking. Next fields of nodes are immutable - * (final). All list additions are performed at the front of each bin. This makes it easy to check changes, and also fast to traverse. When nodes would - * otherwise be changed, new nodes are created to replace them. This works well for hash tables since the bin lists tend to be short. (The average length is - * less than two for the default load factor threshold.) - * - * Read operations can thus proceed without locking, but rely on selected uses of volatiles to ensure that completed write operations performed by other - * threads are noticed. For most purposes, the "count" field, tracking the number of elements, serves as that volatile variable ensuring visibility. This is - * convenient because this field needs to be read in many read operations anyway: - * - * - All (unsynchronized) read operations must first read the "count" field, and should not look at table entries if it is 0. - * - * - All (synchronized) write operations should write to the "count" field after structurally changing any bin. The operations must not take any action that - * could even momentarily cause a concurrent read operation to see inconsistent data. This is made easier by the nature of the read operations in Map. For - * example, no operation can reveal that the table has grown but the threshold has not yet been updated, so there are no atomicity requirements for this with - * respect to reads. - * - * As a guide, all critical volatile reads and writes to the count field are marked in code comments. - */ - private static final class Segment extends ReentrantLock { - - private static final long serialVersionUID = 1L; - - /** - * The number of elements in this segment's region. - */ - private volatile int count; - - /** - * The per-segment table. - */ - private HashEntry[] table; - - /** - * The table is rehashed when its size exceeds this threshold. (The value of this field is always <tt>(int)(capacity * loadFactor)</tt>.) - */ - private int threshold; - - protected Segment(final int initialCapacity, final double lf) { - this.table = new HashEntry[initialCapacity]; - this.threshold = (int) (initialCapacity * lf); - this.count = 0; - } - - protected final String get(final String value, final int hash) { - HashEntry e = null; - String cachedString; - if (this.count != 0) { // volatile read! search for entry without locking - final HashEntry[] tab = this.table; - final int index = hash & (tab.length - 1); - final HashEntry first = tab[index]; - e = first; - while (e != null) { - if (e.hash == hash) { - cachedString = e.get(); - if (value.equals(cachedString)) { - return cachedString; - } - } - e = e.next; - } - } - this.lock(); - try { - final int c = this.count + 1; - if (c >= this.threshold) { - this.cleanup(); - if (c >= this.threshold) { // if still full - this.rehash(); - } - this.count = c; // write volatile - } - final HashEntry[] tab = this.table; - final int index = hash & (tab.length - 1); - final HashEntry first = tab[index]; // the bin the value may be inside - e = first; - while (e != null) { - if (e.hash == hash) { - cachedString = e.get(); - if (value.equals(cachedString)) { - return cachedString; - } - } - e = e.next; - } - tab[index] = new HashEntry(value, hash, first); - this.count = c; // write-volatile - return value; // return now cached string - } finally { - this.unlock(); - } - } - - private final void cleanup() { - int c = this.count; - final HashEntry[] tab = this.table; - for (int index = 0; index < tab.length; index++) { - // find first remaining entry - HashEntry e = tab[index]; - while ((e != null) && (e.get() == null)) { - e = e.next; - c--; - } - if (e == null) { - tab[index] = null; - } else { - // find more existing entries and enqueue before this one - HashEntry first = new HashEntry(e.get(), e.hash, null); - e = e.next; - while (e != null) { - final String s = e.get(); - if (s != null) { - first = new HashEntry(s, e.hash, first); - } else { - c--; - } - e = e.next; - } - tab[index] = first; - } - } - c--; - this.count = c; // write-volatile - } - - /** - * Reclassify nodes in each list to new Map. Because we are using power-of-two expansion, the elements from each bin must either stay at same index, or - * move with a power of two offset. We eliminate unnecessary node creation by catching cases where old nodes can be reused because their next fields - * won't change. Statistically, at the default threshold, only about one-sixth of them need cloning when a table doubles. The nodes they replace will be - * garbage collectable as soon as they are no longer referenced by any reader thread that may be in the midst of traversing table right now. - */ - private final void rehash() { - final HashEntry[] oldTable = this.table; - final int oldCapacity = oldTable.length; - if (oldCapacity >= MAXIMUM_CAPACITY) { - return; - } - final HashEntry[] newTable = new HashEntry[oldCapacity << 1]; - this.threshold = (int) (newTable.length * LOAD_FACTOR); - final int sizeMask = newTable.length - 1; - for (int i = 0; i < oldCapacity; i++) { - // We need to guarantee that any existing reads of old Map can proceed. So we cannot yet null out each bin. - final HashEntry e = oldTable[i]; - - if (e != null) { - final HashEntry next = e.next; - final int idx = e.hash & sizeMask; - - // Single node on list - if (next == null) { - newTable[idx] = e; - } else { - // Reuse trailing consecutive sequence at same slot - HashEntry lastRun = e; - int lastIdx = idx; - for (HashEntry last = next; last != null; last = last.next) { // find end of bin - final int k = last.hash & sizeMask; - if (k != lastIdx) { // NOCS (nested if) - lastIdx = k; - lastRun = last; - } - } - newTable[lastIdx] = lastRun; - - // Clone all remaining nodes - for (HashEntry p = e; p != lastRun; p = p.next) { // NOPMD (no equals meant here) - final int k = p.hash & sizeMask; - final HashEntry n = newTable[k]; - newTable[k] = new HashEntry(p.get(), p.hash, n); - } - } - } - } - this.table = newTable; - } - } -} diff --git a/src/main/java/util/KiekerLoadDriver.java b/src/main/java/util/KiekerLoadDriver.java index 99a250518b65b998f2e509615e55d54d1d95b279..65795567b3a578a10f2d459991a89dedd8836672 100644 --- a/src/main/java/util/KiekerLoadDriver.java +++ b/src/main/java/util/KiekerLoadDriver.java @@ -14,14 +14,14 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.InitialElementProducer; -import teetime.variant.methodcallWithPorts.stage.kieker.Dir2RecordsFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.stage.CollectorSink; +import teetime.stage.InitialElementProducer; +import teetime.stage.kieker.Dir2RecordsFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.trace.TraceMetadata; diff --git a/src/main/java/util/PerformanceTest.java b/src/main/java/util/PerformanceTest.java index 7438d476ee923d5ede2e2aa13a5e8104049d665c..cc672d509e4890a617b19fd3a71ede5592012a49 100644 --- a/src/main/java/util/PerformanceTest.java +++ b/src/main/java/util/PerformanceTest.java @@ -13,7 +13,7 @@ import org.junit.rules.TestWatcher; import org.junit.runner.Description; import teetime.util.StopWatch; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; public abstract class PerformanceTest { diff --git a/src/main/java/util/StatisticsUtil.java b/src/main/java/util/StatisticsUtil.java index de3fd567f44237c07f149be3875115ee4d4c2edc..62d0d0e741072e8d51fbb8706bc796264b8c9d65 100644 --- a/src/main/java/util/StatisticsUtil.java +++ b/src/main/java/util/StatisticsUtil.java @@ -25,11 +25,11 @@ import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import teetime.util.MathUtil; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; /** * @author Christian Wulf - * + * * @since 1.10 */ public class StatisticsUtil { diff --git a/src/test/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java b/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java similarity index 100% rename from src/test/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java rename to src/performancetest/java/kieker/analysis/examples/throughput/ThroughputAnalysisTest.java diff --git a/src/test/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java b/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java similarity index 96% rename from src/test/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java rename to src/performancetest/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java index 3bbd1bb93ddd491fd19548dd1e72b9c90f3c4335..95d173d6d73aed4336d09ea9654be12d444429f3 100644 --- a/src/test/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java +++ b/src/performancetest/java/kieker/analysis/examples/throughput/ThroughputTimestampAnalysisTest.java @@ -22,7 +22,7 @@ import java.util.concurrent.Callable; import org.junit.Test; import teetime.util.StopWatch; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; import util.StatisticsUtil; @@ -31,7 +31,7 @@ import kieker.analysis.exception.AnalysisConfigurationException; /** * @author Nils Christian Ehmke - * + * * @since 1.10 */ public class ThroughputTimestampAnalysisTest extends PerformanceTest { diff --git a/src/test/java/kieker/analysis/stage/EmptyPassOnFilterTest.java b/src/performancetest/java/kieker/analysis/stage/EmptyPassOnFilterTest.java similarity index 100% rename from src/test/java/kieker/analysis/stage/EmptyPassOnFilterTest.java rename to src/performancetest/java/kieker/analysis/stage/EmptyPassOnFilterTest.java diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/ChwHomeComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java similarity index 72% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/ChwHomeComparisonMethodcallWithPorts.java rename to src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java index 65aba3de922eefc2ba66e71db3b7393f9f45e968..8c4ab937fe73bf651c0b9c9f5986601db7b4f102 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/ChwHomeComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples; +package teetime.examples; import static org.junit.Assert.assertEquals; @@ -24,31 +24,31 @@ public class ChwHomeComparisonMethodcallWithPorts implements PerformanceCheckPro } PerformanceResult test1 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + .get("testWithManyObjects(teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); PerformanceResult test9 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); + .get("testWithManyObjects(teetime.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); PerformanceResult test10 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); + .get("testWithManyObjects(teetime.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); PerformanceResult test11 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); + .get("testWithManyObjects(teetime.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); PerformanceResult test14 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); + .get("testWithManyObjects(teetime.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); PerformanceResult test15 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); + .get("testWithManyObjects(teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); PerformanceResult test16a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test17 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); + .get("testWithManyObjects(teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); PerformanceResult test19a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); double value14 = (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5); double value10 = (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/ChwWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java similarity index 71% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/ChwWorkComparisonMethodcallWithPorts.java rename to src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java index e8c6d799a81537f6d61cc7ab20acaf5930ecce01..7e2bf8468ab9dde7b7c16a80dbbf93fa7d6ea611 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/ChwWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples; +package teetime.examples; import static org.junit.Assert.assertEquals; @@ -24,31 +24,31 @@ public class ChwWorkComparisonMethodcallWithPorts implements PerformanceCheckPro } PerformanceResult test1 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + .get("testWithManyObjects(teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); PerformanceResult test9 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); + .get("testWithManyObjects(teetime.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); PerformanceResult test10 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); + .get("testWithManyObjects(teetime.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); PerformanceResult test11 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); + .get("testWithManyObjects(teetime.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); PerformanceResult test14 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); + .get("testWithManyObjects(teetime.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); PerformanceResult test15 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); + .get("testWithManyObjects(teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); PerformanceResult test16a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test17 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); + .get("testWithManyObjects(teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); PerformanceResult test19a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); double value14 = (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5); double value10 = (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/ComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java similarity index 58% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/ComparisonMethodcallWithPorts.java rename to src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java index c06482ba6c9379162ba509c75564a6a56b47938c..2d9876f47df99c14d14619eb079c825d393a6586 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/ComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples; +package teetime.examples; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -6,21 +6,20 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; -import teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import teetime.variant.methodcallWithPorts.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test; -import teetime.variant.methodcallWithPorts.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test; -import teetime.variant.methodcallWithPorts.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test; -import teetime.variant.methodcallWithPorts.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test; -import teetime.variant.methodcallWithPorts.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test; -import teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; -import teetime.variant.methodcallWithPorts.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test; -import teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; +import teetime.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test; +import teetime.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test; +import teetime.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test; +import teetime.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test; +import teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test; +import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; +import teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test; +import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; import util.PerformanceCheckProfile; import util.PerformanceCheckProfileRepository; @RunWith(Suite.class) @SuiteClasses({ - MethodCallThoughputTimestampAnalysis1Test.class, + // MethodCallThoughputTimestampAnalysis1Test.class, MethodCallThoughputTimestampAnalysis9Test.class, MethodCallThoughputTimestampAnalysis10Test.class, MethodCallThoughputTimestampAnalysis11Test.class, diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/NieWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java similarity index 61% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/NieWorkComparisonMethodcallWithPorts.java rename to src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java index 73472fee98069cf42a5be85f024294641b3966e0..bb3c2f6c434264d7fa5283d4ad4d4cf1b4e31ef9 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/NieWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples; +package teetime.examples; import static org.junit.Assert.assertEquals; @@ -24,31 +24,31 @@ public class NieWorkComparisonMethodcallWithPorts implements PerformanceCheckPro } PerformanceResult test1 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + .get("testWithManyObjects(teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); PerformanceResult test9 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); + .get("testWithManyObjects(teetime.examples.experiment09.MethodCallThoughputTimestampAnalysis9Test)"); PerformanceResult test10 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); + .get("testWithManyObjects(teetime.examples.experiment10.MethodCallThoughputTimestampAnalysis10Test)"); PerformanceResult test11 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); + .get("testWithManyObjects(teetime.examples.experiment11.MethodCallThoughputTimestampAnalysis11Test)"); PerformanceResult test14 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); + .get("testWithManyObjects(teetime.examples.experiment14.MethodCallThoughputTimestampAnalysis14Test)"); PerformanceResult test15 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); + .get("testWithManyObjects(teetime.examples.experiment15.MethodCallThoughputTimestampAnalysis15Test)"); PerformanceResult test16a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test17 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcallWithPorts.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); + .get("testWithManyObjects(teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test)"); PerformanceResult test19a = performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19b = performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); PerformanceResult test19c = performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test)"); assertEquals(67, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1); assertEquals(14, (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1); diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java similarity index 72% rename from src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java rename to src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java index aeab2733bbfc9771a3b63eb74fc953e0982e3588..525abdb84b7630dd8c3da6355b8dbef9e1af098b 100644 --- a/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcall.examples.experiment01; +package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.PerformanceCheckProfile; @@ -15,7 +15,7 @@ public class ChwHomePerformanceCheck implements PerformanceCheckProfile { @Override public void check() { PerformanceResult test01 = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + .get("testWithManyObjects(teetime.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/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java similarity index 72% rename from src/test/java/teetime/variant/methodcall/examples/experiment01/ChwWorkPerformanceCheck.java rename to src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java index 44fa5ff7c9ede67e29c7e4e391536df1ebe178e1..3229033091c918d7556168a446dab9804066be19 100644 --- a/src/test/java/teetime/variant/methodcall/examples/experiment01/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcall.examples.experiment01; +package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.PerformanceCheckProfile; @@ -15,7 +15,7 @@ public class ChwWorkPerformanceCheck implements PerformanceCheckProfile { @Override public void check() { PerformanceResult test01 = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); + .get("testWithManyObjects(teetime.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/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java rename to src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java index e40923d0255bf8ae9c8d4ae260b8f85652ee0259..b6ded5499195cd17dd690f3a5dd7c0f0292618fd 100644 --- a/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java +++ b/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java @@ -13,14 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcall.examples.experiment01; +package teetime.examples.experiment01; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import teetime.examples.experiment16.ChwHomePerformanceCheck; +import teetime.examples.experiment16.ChwWorkPerformanceCheck; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceCheckProfile; import util.PerformanceCheckProfileRepository; import util.PerformanceTest; diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThroughputAnalysis1.java b/src/performancetest/java/teetime/examples/experiment01/MethodCallThroughputAnalysis1.java similarity index 51% rename from src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThroughputAnalysis1.java rename to src/performancetest/java/teetime/examples/experiment01/MethodCallThroughputAnalysis1.java index aac7fca2481b15bbcad3937d493364e6e009fc72..f84be673984f36e5fec20de7fc408466118f8986 100644 --- a/src/test/java/teetime/variant/methodcall/examples/experiment01/MethodCallThroughputAnalysis1.java +++ b/src/performancetest/java/teetime/examples/experiment01/MethodCallThroughputAnalysis1.java @@ -13,25 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcall.examples.experiment01; +package teetime.examples.experiment01; import java.util.List; +import teetime.framework.OldAnalysis; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; +import teetime.util.TimestampObject; /** * @author Christian Wulf - * + * * @since 1.10 */ -public class MethodCallThroughputAnalysis1 extends Analysis { +public class MethodCallThroughputAnalysis1 extends OldAnalysis { private long numInputObjects; private ConstructorClosure<TimestampObject> inputObjectCreator; @@ -42,45 +37,45 @@ public class MethodCallThroughputAnalysis1 extends Analysis { @Override public void init() { super.init(); - this.runnable = this.buildPipeline(); + // this.runnable = this.buildPipeline(); } /** * @param numNoopFilters * @since 1.10 */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final Runnable runnable = new Runnable() { - @Override - public void run() { - while (true) { - TimestampObject object = objectProducer.execute(null); - if (object == null) { - return; - } - - object = startTimestampFilter.execute(object); - for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { - object = noopFilter.execute(object); - } - object = stopTimestampFilter.execute(object); - collectorSink.execute(object); - } - } - }; - return runnable; - } + // private Runnable buildPipeline() { + // @SuppressWarnings("unchecked") + // final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; + // // create stages + // final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); + // final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); + // for (int i = 0; i < noopFilters.length; i++) { + // noopFilters[i] = new NoopFilter<TimestampObject>(); + // } + // final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); + // final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); + // + // final Runnable runnable = new Runnable() { + // @Override + // public void run() { + // while (true) { + // TimestampObject object = objectProducer.execute(null); + // if (object == null) { + // return; + // } + // + // object = startTimestampFilter.execute(object); + // for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { + // object = noopFilter.execute(object); + // } + // object = stopTimestampFilter.execute(object); + // collectorSink.execute(object); + // } + // } + // }; + // return runnable; + // } @Override public void start() { diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java similarity index 91% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java rename to src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java index b6f0f532f4e9067370cea3aedefff4ddffcbfe4d..bd5d52fa6c0d9eed4ad6a7e81989a8cdfc021349 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment09; +package teetime.examples.experiment09; import org.junit.Test; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** * @author Christian Wulf - * + * * @since 1.10 */ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThroughputAnalysis9.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java similarity index 79% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThroughputAnalysis9.java rename to src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java index 117954b87f57dbc4c10ede61dba0ee7bf94ccb2d..5ffed1c118611ce15eb3ed3ad270e9de439c263c 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment09/MethodCallThroughputAnalysis9.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java @@ -13,29 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment09; +package teetime.examples.experiment09; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.CommittablePipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.CommittablePipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis9 extends Analysis { +public class MethodCallThroughputAnalysis9 extends OldAnalysis { private int numInputObjects; private ConstructorClosure<TimestampObject> inputObjectCreator; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java rename to src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java index 14858bc3d2ceb70bb292e99b2b17587fe57bcc08..d8b872035a26c2dd77b0a45dda3167536e8684c5 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java +++ b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment10; +package teetime.examples.experiment10; import org.junit.Test; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThroughputAnalysis10.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java similarity index 80% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThroughputAnalysis10.java rename to src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java index 3267dc93d92918ae12b18aad982b47363946d139..4cc544f9722feb7ea94cba4351ed8b774e46c0f0 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment10/MethodCallThroughputAnalysis10.java +++ b/src/performancetest/java/teetime/examples/experiment10/MethodCallThroughputAnalysis10.java @@ -13,28 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment10; +package teetime.examples.experiment10; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis10 extends Analysis { +public class MethodCallThroughputAnalysis10 extends OldAnalysis { private long numInputObjects; private ConstructorClosure<TimestampObject> inputObjectCreator; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java rename to src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java index 1b225360272d279d0bded0fc423fbf8d60127f48..a6149b9a0f812e827b3150729fdf98ce42905a6a 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment11; +package teetime.examples.experiment11; import org.junit.Test; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThroughputAnalysis11.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java similarity index 81% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThroughputAnalysis11.java rename to src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java index f7cba876b2f7fc0397151f3a7a1db0dc27cbdd55..76dc925eaf56ed5b348111dd867220484a501a91 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment11/MethodCallThroughputAnalysis11.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java @@ -13,29 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment11; +package teetime.examples.experiment11; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.UnorderedGrowablePipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.UnorderedGrowablePipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis11 extends Analysis { +public class MethodCallThroughputAnalysis11 extends OldAnalysis { private long numInputObjects; private ConstructorClosure<TimestampObject> inputObjectCreator; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java rename to src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java index e32ecf51c062a151f232a4f05020dcc233e39e36..1f87c070e9f6ee4434abdf91d34c8d0c385c69b2 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment14; +package teetime.examples.experiment14; import org.junit.Test; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThroughputAnalysis14.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java similarity index 78% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThroughputAnalysis14.java rename to src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java index 04a3c5b4e32fdf6cd32186436d26a210aacf1b1e..f2bfdf3521d0483180461988cbe21a848ca83d7c 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment14/MethodCallThroughputAnalysis14.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java @@ -13,31 +13,31 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment14; +package teetime.examples.experiment14; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.IPipe; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis14 extends Analysis { +public class MethodCallThroughputAnalysis14 extends OldAnalysis { private long numInputObjects; private ConstructorClosure<TimestampObject> inputObjectCreator; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java b/src/performancetest/java/teetime/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java rename to src/performancetest/java/teetime/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java index bf350f0c011c830f4fcc708035e0cdb2686bb626..91faf50943bd301c7c395a24d384d6afd6b4f1af 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java +++ b/src/performancetest/java/teetime/examples/experiment15/MethodCallThoughputTimestampAnalysis15Test.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment15; +package teetime.examples.experiment15; import org.junit.Test; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java similarity index 78% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java rename to src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java index ba2ade3ad96d1553983cae7c821b970fb46dba43..acadf1ede7a143e522d2617c539f6ba846cf3c4b 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment15/MethodCallThroughputAnalysis15.java +++ b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java @@ -13,34 +13,34 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment15; +package teetime.examples.experiment15; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.OrderedGrowableArrayPipe; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.Delay; +import teetime.stage.basic.Sink; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.OrderedGrowableArrayPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.Delay; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis15 extends Analysis { +public class MethodCallThroughputAnalysis15 extends OldAnalysis { // FIXME this analysis sometimes runs infinitely private static final int SPSC_INITIAL_CAPACITY = 4; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java similarity index 65% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java rename to src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java index 8e3fe93b52879c0cd8103da5fa1e393258cc500b..a3106094fb720993ecbd804ef6ad7cc67d58c0be 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.experiment16; +package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.PerformanceCheckProfile; @@ -15,11 +15,11 @@ public class ChwHomePerformanceCheck implements PerformanceCheckProfile { @Override public void check() { PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16b = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); // check speedup double speedupB = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; double speedupC = (double) test16a.overallDurationInNs / test16c.overallDurationInNs; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java similarity index 65% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwWorkPerformanceCheck.java rename to src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java index c60b62627abc4b2ae60b2b8c3c1f60515ce90bad..eba4502dfcf156fbc90d99838d11d0da4ca768f3 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.experiment16; +package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.PerformanceCheckProfile; @@ -10,11 +10,11 @@ public class ChwWorkPerformanceCheck implements PerformanceCheckProfile { @Override public void check() { PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16b = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults - .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); // check speedup double speedupB = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; double speedupC = (double) test16a.overallDurationInNs / test16c.overallDurationInNs; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java similarity index 95% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java rename to src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java index 46147ec38df84508d6440852c58884a0fafcb861..86bb46fb274ed3e71b34f0d28f5e554002976cf3 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java +++ b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment16; +package teetime.examples.experiment16; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -23,7 +23,7 @@ import org.junit.runners.MethodSorters; import teetime.util.ConstructorClosure; import teetime.util.ListUtil; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceCheckProfile; import util.PerformanceCheckProfileRepository; import util.PerformanceTest; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java b/src/performancetest/java/teetime/examples/experiment16/MethodCallThroughputAnalysis16.java similarity index 85% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java rename to src/performancetest/java/teetime/examples/experiment16/MethodCallThroughputAnalysis16.java index 1230451f48fe905684d72bdf2d84c08450e3fed2..426d108c61443d2406ea65552f0671f2ddc78a1d 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment16/MethodCallThroughputAnalysis16.java +++ b/src/performancetest/java/teetime/examples/experiment16/MethodCallThroughputAnalysis16.java @@ -13,33 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment16; +package teetime.examples.experiment16; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.Relay; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.distributor.Distributor; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis16 extends Analysis { +public class MethodCallThroughputAnalysis16 extends OldAnalysis { private static final int SPSC_INITIAL_CAPACITY = 100100; private static final int NUM_WORKER_THREADS = Runtime.getRuntime().availableProcessors(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java b/src/performancetest/java/teetime/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java similarity index 92% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java rename to src/performancetest/java/teetime/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java index 804a930d90ddf70e88088a01adde9e49cf8a4737..69137f7471c73b9e48acfd343e2cead3ec7a99cf 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java +++ b/src/performancetest/java/teetime/examples/experiment17/MethodCallThoughputTimestampAnalysis17Test.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment17; +package teetime.examples.experiment17; import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.ListUtil; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThroughputAnalysis17.java b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java similarity index 82% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThroughputAnalysis17.java rename to src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java index df4fd02977f6f0162178934d997ae9da5a2ad6b5..c1954504e7a0a135138dceffa148ffcb4dd030a1 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment17/MethodCallThroughputAnalysis17.java +++ b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java @@ -13,39 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment17; +package teetime.examples.experiment17; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.StageWithPort; +import teetime.framework.pipe.DummyPipe; +import teetime.framework.pipe.IPipe; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.RelayTestPipe; +import teetime.framework.pipe.UnorderedGrowablePipe; +import teetime.framework.signal.TerminatingSignal; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.Relay; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.StageWithPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.DummyPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.RelayTestPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.UnorderedGrowablePipe; -import teetime.variant.methodcallWithPorts.framework.core.signal.TerminatingSignal; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis17 extends Analysis { +public class MethodCallThroughputAnalysis17 extends OldAnalysis { private static final int SPSC_INITIAL_CAPACITY = 100100; private static final int NUM_WORKER_THREADS = Runtime.getRuntime().availableProcessors(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment18/MethodCallThroughputAnalysis18.java b/src/performancetest/java/teetime/examples/experiment18/MethodCallThroughputAnalysis18.java similarity index 84% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment18/MethodCallThroughputAnalysis18.java rename to src/performancetest/java/teetime/examples/experiment18/MethodCallThroughputAnalysis18.java index 6a264973d68522161f43f02ae03d857332f997b3..e36abb3b103ab569ab8702c2e211c31f7ded408a 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment18/MethodCallThroughputAnalysis18.java +++ b/src/performancetest/java/teetime/examples/experiment18/MethodCallThroughputAnalysis18.java @@ -13,33 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment18; +package teetime.examples.experiment18; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SpScPipe; +import teetime.framework.pipe.UnorderedGrowablePipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.Relay; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.distributor.Distributor; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.UnorderedGrowablePipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis18 extends Analysis { +public class MethodCallThroughputAnalysis18 extends OldAnalysis { private static final int SPSC_INITIAL_CAPACITY = 4; private static final int NUM_WORKER_THREADS = Runtime.getRuntime().availableProcessors(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java b/src/performancetest/java/teetime/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java similarity index 82% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java rename to src/performancetest/java/teetime/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java index 03951f82c05a7173d411117db521d2dd273ce2e8..32f76c6039eca899468fc0ffea2bdcec470da6b0 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java +++ b/src/performancetest/java/teetime/examples/experiment19/MethodCallThoughputTimestampAnalysis19Test.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment19; +package teetime.examples.experiment19; import org.junit.FixMethodOrder; import org.junit.Test; @@ -21,7 +21,7 @@ import org.junit.runners.MethodSorters; import teetime.util.ConstructorClosure; import teetime.util.ListUtil; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; +import teetime.util.TimestampObject; import util.PerformanceTest; /** @@ -52,11 +52,11 @@ public class MethodCallThoughputTimestampAnalysis19Test extends PerformanceTest // @AfterClass // public static void afterClass() { // PerformanceResult test16a = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd1Thread(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + // .get("testWithManyObjectsAnd1Thread(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); // PerformanceResult test16b = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd2Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + // .get("testWithManyObjectsAnd2Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); // PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults - // .get("testWithManyObjectsAnd4Threads(teetime.variant.methodcallWithPorts.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); + // .get("testWithManyObjectsAnd4Threads(teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test)"); // // check speedup // assertEquals(2, (double) test16a.overallDurationInNs / test16b.overallDurationInNs, 0.2); // assertEquals(2.5, (double) test16a.overallDurationInNs / test16c.overallDurationInNs, 0.2); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThroughputAnalysis19.java b/src/performancetest/java/teetime/examples/experiment19/MethodCallThroughputAnalysis19.java similarity index 84% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThroughputAnalysis19.java rename to src/performancetest/java/teetime/examples/experiment19/MethodCallThroughputAnalysis19.java index b7e01fe0bfadffa987638a03f1d62edfd6d4fdab..9f6f95c1963077cdfc609a40fb4442c017ef4da0 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/experiment19/MethodCallThroughputAnalysis19.java +++ b/src/performancetest/java/teetime/examples/experiment19/MethodCallThroughputAnalysis19.java @@ -13,33 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.experiment19; +package teetime.examples.experiment19; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.OrderedGrowableArrayPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.CollectorSink; +import teetime.stage.NoopFilter; +import teetime.stage.ObjectProducer; +import teetime.stage.Relay; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.distributor.Distributor; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.OrderedGrowableArrayPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.NoopFilter; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; +import teetime.util.TimestampObject; /** * @author Christian Wulf * * @since 1.10 */ -public class MethodCallThroughputAnalysis19 extends Analysis { +public class MethodCallThroughputAnalysis19 extends OldAnalysis { private static final int SPSC_INITIAL_CAPACITY = 100100; private static final int NUM_WORKER_THREADS = Runtime.getRuntime().availableProcessors(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLogging.java b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLogging.java similarity index 66% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLogging.java rename to src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLogging.java index 97d4d8680f700b1ac2b51d5d05107e6405a1ac03..0f8fce8e28cd9e8c49aa7511cfc9975cf3420202 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLogging.java +++ b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLogging.java @@ -1,11 +1,11 @@ -package teetime.variant.methodcallWithPorts.examples.kiekerdays; +package teetime.examples.kiekerdays; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.stage.io.TCPReader; -public class TcpTraceLogging extends Analysis { +public class TcpTraceLogging extends OldAnalysis { private Thread tcpThread; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLoggingExplorviz.java b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLoggingExplorviz.java similarity index 65% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLoggingExplorviz.java rename to src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLoggingExplorviz.java index d81ab05b49eb620fce45c658813cb824b25f925a..08975c93b73b7b6f13d23a90e8fd4aa6d9a5e8e3 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceLoggingExplorviz.java +++ b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceLoggingExplorviz.java @@ -1,16 +1,16 @@ -package teetime.variant.methodcallWithPorts.examples.kiekerdays; +package teetime.examples.kiekerdays; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.explorviz.KiekerRecordTcpReader; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.stage.basic.Sink; +import teetime.stage.explorviz.KiekerRecordTcpReader; import kieker.common.record.IMonitoringRecord; -public class TcpTraceLoggingExplorviz extends Analysis { +public class TcpTraceLoggingExplorviz extends OldAnalysis { private Thread tcpThread; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReconstruction.java b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReconstruction.java similarity index 82% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReconstruction.java rename to src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReconstruction.java index 016514cf0205ae130df137f6bb87b7b47fbd4374..e1fa8409e924d93d919e16c43ccd804af5894676 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReconstruction.java +++ b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReconstruction.java @@ -1,29 +1,29 @@ -package teetime.variant.methodcallWithPorts.examples.kiekerdays; +package teetime.examples.kiekerdays; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.InstanceOfFilter; +import teetime.stage.Relay; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.IFlowRecord; -public class TcpTraceReconstruction extends Analysis { +public class TcpTraceReconstruction extends OldAnalysis { private static final int NUM_VIRTUAL_CORES = Runtime.getRuntime().availableProcessors(); private static final int MIO = 1000000; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReduction.java b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReduction.java similarity index 81% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReduction.java rename to src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReduction.java index 82f80ee6f3f53fad5e81017a8094870f36f62d43..6950e52260ce4bf22cc7c542bbf2308d2d0ca776 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/kiekerdays/TcpTraceReduction.java +++ b/src/performancetest/java/teetime/examples/kiekerdays/TcpTraceReduction.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.kiekerdays; +package teetime.examples.kiekerdays; import java.util.ArrayList; import java.util.LinkedList; @@ -6,30 +6,30 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import teetime.framework.HeadPipeline; +import teetime.framework.HeadStage; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.InstanceOfFilter; +import teetime.stage.Relay; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; +import teetime.stage.kieker.traceReduction.TraceAggregationBuffer; +import teetime.stage.kieker.traceReduction.TraceComperator; +import teetime.stage.kieker.traceReduction.TraceReductionFilter; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceAggregationBuffer; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceComperator; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceReductionFilter; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.IFlowRecord; -public class TcpTraceReduction extends Analysis { +public class TcpTraceReduction extends OldAnalysis { private static final int NUM_VIRTUAL_CORES = Runtime.getRuntime().availableProcessors(); private static final int MIO = 1000000; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/Countdown.java b/src/performancetest/java/teetime/examples/loopStage/Countdown.java similarity index 77% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/Countdown.java rename to src/performancetest/java/teetime/examples/loopStage/Countdown.java index cc7dbed62637a16eebb61ec559c7d4ae2580143c..f70e3eb60a80eadb286bd2c78095040b26ccd2ed 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/Countdown.java +++ b/src/performancetest/java/teetime/examples/loopStage/Countdown.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.examples.loopStage; +package teetime.examples.loopStage; -import teetime.variant.methodcallWithPorts.framework.core.InputPort; -import teetime.variant.methodcallWithPorts.framework.core.OutputPort; -import teetime.variant.methodcallWithPorts.framework.core.ProducerStage; +import teetime.framework.InputPort; +import teetime.framework.OutputPort; +import teetime.framework.ProducerStage; public class Countdown extends ProducerStage<Void> { diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/FiniteSignalPassingTest.java b/src/performancetest/java/teetime/examples/loopStage/FiniteSignalPassingTest.java similarity index 82% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/FiniteSignalPassingTest.java rename to src/performancetest/java/teetime/examples/loopStage/FiniteSignalPassingTest.java index f972c021fda2ac05327804aed548da08bf903f25..ffcef1df21063d6bac47c197222e4632d000c316 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/FiniteSignalPassingTest.java +++ b/src/performancetest/java/teetime/examples/loopStage/FiniteSignalPassingTest.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.loopStage; +package teetime.examples.loopStage; import static org.junit.Assert.assertEquals; @@ -6,8 +6,8 @@ import java.util.Collection; import org.junit.Test; +import teetime.framework.Analysis; import teetime.util.Pair; -import teetime.variant.methodcallWithPorts.framework.core.Analysis; public class FiniteSignalPassingTest { diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/LoopStageAnalysisConfiguration.java b/src/performancetest/java/teetime/examples/loopStage/LoopStageAnalysisConfiguration.java similarity index 53% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/LoopStageAnalysisConfiguration.java rename to src/performancetest/java/teetime/examples/loopStage/LoopStageAnalysisConfiguration.java index 8fd8a5ade876939a37654198e18060b642740e12..6f577b4143ff364bb961910ca0d243d451a5524e 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/loopStage/LoopStageAnalysisConfiguration.java +++ b/src/performancetest/java/teetime/examples/loopStage/LoopStageAnalysisConfiguration.java @@ -1,8 +1,8 @@ -package teetime.variant.methodcallWithPorts.examples.loopStage; +package teetime.examples.loopStage; -import teetime.variant.methodcallWithPorts.framework.core.AnalysisConfiguration; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; +import teetime.framework.AnalysisConfiguration; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; public class LoopStageAnalysisConfiguration extends AnalysisConfiguration { diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderAnalysisTest.java b/src/performancetest/java/teetime/examples/recordReader/RecordReaderAnalysisTest.java similarity index 95% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderAnalysisTest.java rename to src/performancetest/java/teetime/examples/recordReader/RecordReaderAnalysisTest.java index 94776b9fece3a6d2380e76b1ec985b1043b8b413..6a49e22928924bf8ebc2fc08be376258d2ecd919 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/recordReader/RecordReaderAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.recordReader; +package teetime.examples.recordReader; import static org.junit.Assert.assertEquals; @@ -23,8 +23,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import teetime.framework.Analysis; import teetime.util.StopWatch; -import teetime.variant.methodcallWithPorts.framework.core.Analysis; import kieker.common.record.IMonitoringRecord; import kieker.common.record.controlflow.OperationExecutionRecord; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderConfiguration.java b/src/performancetest/java/teetime/examples/recordReader/RecordReaderConfiguration.java similarity index 75% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderConfiguration.java rename to src/performancetest/java/teetime/examples/recordReader/RecordReaderConfiguration.java index 39a18b2e0f6cb0d1b6e78a7c46ddaf2f20692b41..cbcae8ca4682990a65859571749545dbec312cfc 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/recordReader/RecordReaderConfiguration.java +++ b/src/performancetest/java/teetime/examples/recordReader/RecordReaderConfiguration.java @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.recordReader; +package teetime.examples.recordReader; import java.io.File; import java.util.LinkedList; import java.util.List; -import teetime.variant.methodcallWithPorts.framework.core.AnalysisConfiguration; -import teetime.variant.methodcallWithPorts.framework.core.HeadStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.PipeOrdering; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.InitialElementProducer; -import teetime.variant.methodcallWithPorts.stage.kieker.Dir2RecordsFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; +import teetime.framework.AnalysisConfiguration; +import teetime.framework.HeadStage; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.PipeFactory.PipeOrdering; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; +import teetime.stage.CollectorSink; +import teetime.stage.InitialElementProducer; +import teetime.stage.kieker.Dir2RecordsFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; import kieker.common.record.IMonitoringRecord; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/ChwHomeTcpTraceReadingTest.java b/src/performancetest/java/teetime/examples/traceReading/ChwHomeTcpTraceReadingTest.java similarity index 97% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/ChwHomeTcpTraceReadingTest.java rename to src/performancetest/java/teetime/examples/traceReading/ChwHomeTcpTraceReadingTest.java index b0b1a7b471bb9f3ab27d74506ce6723dd7d68d8c..04f8c1cb6ebaa69df37767d28766d5d5eff3acdb 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/ChwHomeTcpTraceReadingTest.java +++ b/src/performancetest/java/teetime/examples/traceReading/ChwHomeTcpTraceReadingTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReading; +package teetime.examples.traceReading; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/TcpTraceLoggingExtAnalysis.java b/src/performancetest/java/teetime/examples/traceReading/TcpTraceLoggingExtAnalysis.java similarity index 75% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/TcpTraceLoggingExtAnalysis.java rename to src/performancetest/java/teetime/examples/traceReading/TcpTraceLoggingExtAnalysis.java index 580cc59f2aeda29b36fe6fb2747e21c342e7fbf4..134eb645f5d2ec994d9daa94e8ae9b34f27f6a5e 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReading/TcpTraceLoggingExtAnalysis.java +++ b/src/performancetest/java/teetime/examples/traceReading/TcpTraceLoggingExtAnalysis.java @@ -1,22 +1,22 @@ -package teetime.variant.methodcallWithPorts.examples.traceReading; +package teetime.examples.traceReading; import java.util.List; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.Counter; -import teetime.variant.methodcallWithPorts.stage.ElementThroughputMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.Counter; +import teetime.stage.ElementThroughputMeasuringStage; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; import kieker.common.record.IMonitoringRecord; -public class TcpTraceLoggingExtAnalysis extends Analysis { +public class TcpTraceLoggingExtAnalysis extends OldAnalysis { private Thread clockThread; private Thread tcpThread; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java b/src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java similarity index 97% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java rename to src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java index f78436fc42cbfba8d1cf00b43067549536b0e458..e5f30380b48175241c091c0a1ddb5536b90e9b0d 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTcpTraceReconstructionAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java b/src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java similarity index 98% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java rename to src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java index cd365a6da63578dab4c941b7d1c5a54afde92331..149c134df0edbc705a916a4877ac6da1bd86927f 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/ChwHomeTraceReconstructionAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java b/src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java similarity index 97% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java rename to src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java index 48658d2f5771652241b7e58ecd5ebce57f1991dd..8f99ad31f0af0e330b5424fe64725898b7b4e09f 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTcpTraceReconstructionAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java b/src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java similarity index 98% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java rename to src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java index 1d1b403a9e6f983a7bc0d57d30c88bfad4d6686f..3c0604ae876e5711c3bcb6042219ba56d8fee3ff 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/ChwWorkTraceReconstructionAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java b/src/performancetest/java/teetime/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java similarity index 96% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java rename to src/performancetest/java/teetime/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java index 8bd6ea90c32bb0376108b34e78436d24d1d093de..9e45c3b6181d23135f2b1363485c5718d49eef9f 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/KiekerTraceReconstructionAnalysis.java @@ -1,10 +1,10 @@ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import java.io.File; import java.util.LinkedList; import java.util.List; -import teetime.variant.explicitScheduling.framework.core.Analysis; +import teetime.framework.OldAnalysis; import kieker.analysis.AnalysisController; import kieker.analysis.IAnalysisController; @@ -25,7 +25,7 @@ import kieker.analysis.stage.TimeReader; import kieker.common.configuration.Configuration; import kieker.common.record.flow.IFlowRecord; -public class KiekerTraceReconstructionAnalysis extends Analysis { +public class KiekerTraceReconstructionAnalysis extends OldAnalysis { private final IAnalysisController analysisController = new AnalysisController(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java b/src/performancetest/java/teetime/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java similarity index 98% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java rename to src/performancetest/java/teetime/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java index dd4c3064d462f0996072d4a7c65d2cac72d59724..41a7926b63abd446ff473c8ff5ed1c0e03872324 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/NieWorkKiekerTraceReconstructionAnalysisTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java b/src/performancetest/java/teetime/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java similarity index 82% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java rename to src/performancetest/java/teetime/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java index 6ba339ac436b5f1ffb984e5bcc0de192c4357ffd..e503a3d48531fee3c47c73c8e71c57c828f00231 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/TcpTraceReconstructionAnalysis.java @@ -1,29 +1,29 @@ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.Counter; +import teetime.stage.ElementThroughputMeasuringStage; +import teetime.stage.InstanceOfFilter; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.Counter; -import teetime.variant.methodcallWithPorts.stage.ElementThroughputMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.IFlowRecord; -public class TcpTraceReconstructionAnalysis extends Analysis { +public class TcpTraceReconstructionAnalysis extends OldAnalysis { private static final int MIO = 1000000; private static final int TCP_RELAY_MAX_SIZE = 2 * MIO; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TraceReconstructionAnalysis.java b/src/performancetest/java/teetime/examples/traceReconstruction/TraceReconstructionAnalysis.java similarity index 76% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TraceReconstructionAnalysis.java rename to src/performancetest/java/teetime/examples/traceReconstruction/TraceReconstructionAnalysis.java index d51eec2141b9d3d59be72d2d1b0015d4d87f6e48..687084969a819fdf61e9734a85bfa1eba942f5fb 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstruction/TraceReconstructionAnalysis.java +++ b/src/performancetest/java/teetime/examples/traceReconstruction/TraceReconstructionAnalysis.java @@ -1,36 +1,36 @@ -package teetime.variant.methodcallWithPorts.examples.traceReconstruction; +package teetime.examples.traceReconstruction; import java.io.File; import java.util.LinkedList; import java.util.List; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Cache; +import teetime.stage.Clock; +import teetime.stage.CollectorSink; +import teetime.stage.Counter; +import teetime.stage.ElementThroughputMeasuringStage; +import teetime.stage.InitialElementProducer; +import teetime.stage.InstanceOfFilter; +import teetime.stage.basic.merger.Merger; +import teetime.stage.kieker.Dir2RecordsFilter; +import teetime.stage.kieker.className.ClassNameRegistryRepository; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; +import teetime.stage.stringBuffer.StringBufferFilter; +import teetime.stage.stringBuffer.handler.IMonitoringRecordHandler; +import teetime.stage.stringBuffer.handler.StringHandler; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Cache; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.CollectorSink; -import teetime.variant.methodcallWithPorts.stage.Counter; -import teetime.variant.methodcallWithPorts.stage.ElementThroughputMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.InitialElementProducer; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.basic.merger.Merger; -import teetime.variant.methodcallWithPorts.stage.kieker.Dir2RecordsFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.className.ClassNameRegistryRepository; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.StringBufferFilter; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.handler.IMonitoringRecordHandler; -import teetime.variant.methodcallWithPorts.stage.stringBuffer.handler.StringHandler; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.IFlowRecord; -public class TraceReconstructionAnalysis extends Analysis { +public class TraceReconstructionAnalysis extends OldAnalysis { private final List<TraceEventRecords> elementCollection = new LinkedList<TraceEventRecords>(); diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java similarity index 96% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java rename to src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java index ef0474b28b3a3196794104eb74b3267e93523819..1b969f1c364f7ac3057a6a89bbcb458439d14e75 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwHomeTcpTraceReconstructionAnalysisWithThreadsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstructionWithThreads; +package teetime.examples.traceReconstructionWithThreads; import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.greaterThan; @@ -32,10 +32,10 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import teetime.framework.Analysis; +import teetime.framework.pipe.SpScPipe; import teetime.util.ListUtil; import teetime.util.StopWatch; -import teetime.variant.methodcallWithPorts.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; import util.StatisticsUtil; /** diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java similarity index 94% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java rename to src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java index 84a3cc49d3d1b72d36562484f7fd077cea0261ba..99e8e04bf50349e97abce274dce041e8fa162566 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java +++ b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReconstructionWithThreads; +package teetime.examples.traceReconstructionWithThreads; import static org.junit.Assert.assertEquals; @@ -27,10 +27,10 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import teetime.framework.Analysis; +import teetime.framework.pipe.SpScPipe; import teetime.util.ListUtil; import teetime.util.StopWatch; -import teetime.variant.methodcallWithPorts.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; import util.StatisticsUtil; /** @@ -81,7 +81,7 @@ public class ChwWorkTcpTraceReconstructionAnalysisWithThreadsTest { // Median trace throughput: 42 traces/time unit // Duration: 21614 ms - // [2014-07-04 01:06:10 PM] WARNUNG: Reader interrupted (teetime.variant.methodcallWithPorts.stage.io.TCPReader$TCPStringReader run) + // [2014-07-04 01:06:10 PM] WARNUNG: Reader interrupted (teetime.stage.io.TCPReader$TCPStringReader run) // Max size of tcp-relay pipe: 167758 // Median trace throughput: 6 traces/time unit // Duration: 22373 ms diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java similarity index 89% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java rename to src/performancetest/java/teetime/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java index 06c17f0530f20da6eedc530b1c8e585ac64e90f1..fff9e149c7763ed976075d70f5215c4a851863b0 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java +++ b/src/performancetest/java/teetime/examples/traceReconstructionWithThreads/TcpTraceReconstructionAnalysisWithThreadsConfiguration.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.traceReconstructionWithThreads; +package teetime.examples.traceReconstructionWithThreads; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -6,24 +6,24 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import teetime.framework.AnalysisConfiguration; +import teetime.framework.HeadPipeline; +import teetime.framework.StageWithPort; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.Counter; +import teetime.stage.ElementDelayMeasuringStage; +import teetime.stage.ElementThroughputMeasuringStage; +import teetime.stage.InstanceCounter; +import teetime.stage.InstanceOfFilter; +import teetime.stage.Relay; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.methodcallWithPorts.framework.core.AnalysisConfiguration; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.StageWithPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.Counter; -import teetime.variant.methodcallWithPorts.stage.ElementDelayMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.ElementThroughputMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.InstanceCounter; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java b/src/performancetest/java/teetime/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java similarity index 98% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java rename to src/performancetest/java/teetime/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java index 7db26144051830c3bcf246a74ed04b6f64e3a81f..340b416197e81cca1d0c5b278af3e29287cbe564 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java +++ b/src/performancetest/java/teetime/examples/traceReductionWithThreads/ChwWorkTcpTraceReductionAnalysisWithThreadsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ -package teetime.variant.methodcallWithPorts.examples.traceReductionWithThreads; +package teetime.examples.traceReductionWithThreads; import static org.junit.Assert.assertEquals; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java b/src/performancetest/java/teetime/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java similarity index 86% rename from src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java rename to src/performancetest/java/teetime/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java index 2a0f4b07840ff9f28bae5a51fbb17dd4e93f9929..8879fc237faaa131662fa65b1501e0e326324613 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java +++ b/src/performancetest/java/teetime/examples/traceReductionWithThreads/TcpTraceReductionAnalysisWithThreads.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.examples.traceReductionWithThreads; +package teetime.examples.traceReductionWithThreads; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -8,35 +8,35 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import teetime.framework.HeadPipeline; +import teetime.framework.OldAnalysis; +import teetime.framework.RunnableStage; +import teetime.framework.StageWithPort; +import teetime.framework.pipe.SingleElementPipe; +import teetime.framework.pipe.SpScPipe; +import teetime.stage.Clock; +import teetime.stage.Counter; +import teetime.stage.ElementDelayMeasuringStage; +import teetime.stage.ElementThroughputMeasuringStage; +import teetime.stage.InstanceCounter; +import teetime.stage.InstanceOfFilter; +import teetime.stage.Relay; +import teetime.stage.basic.Sink; +import teetime.stage.basic.distributor.Distributor; +import teetime.stage.io.TCPReader; +import teetime.stage.kieker.traceReconstruction.TraceReconstructionFilter; +import teetime.stage.kieker.traceReduction.TraceAggregationBuffer; +import teetime.stage.kieker.traceReduction.TraceComperator; +import teetime.stage.kieker.traceReduction.TraceReductionFilter; import teetime.util.concurrent.hashmap.ConcurrentHashMapWithDefault; import teetime.util.concurrent.hashmap.TraceBuffer; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcallWithPorts.framework.core.HeadPipeline; -import teetime.variant.methodcallWithPorts.framework.core.RunnableStage; -import teetime.variant.methodcallWithPorts.framework.core.StageWithPort; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SingleElementPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.SpScPipe; -import teetime.variant.methodcallWithPorts.stage.Clock; -import teetime.variant.methodcallWithPorts.stage.Counter; -import teetime.variant.methodcallWithPorts.stage.ElementDelayMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.ElementThroughputMeasuringStage; -import teetime.variant.methodcallWithPorts.stage.InstanceCounter; -import teetime.variant.methodcallWithPorts.stage.InstanceOfFilter; -import teetime.variant.methodcallWithPorts.stage.Relay; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; -import teetime.variant.methodcallWithPorts.stage.basic.distributor.Distributor; -import teetime.variant.methodcallWithPorts.stage.io.TCPReader; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReconstruction.TraceReconstructionFilter; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceAggregationBuffer; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceComperator; -import teetime.variant.methodcallWithPorts.stage.kieker.traceReduction.TraceReductionFilter; import kieker.analysis.plugin.filter.flow.TraceEventRecords; import kieker.common.record.IMonitoringRecord; import kieker.common.record.flow.IFlowRecord; import kieker.common.record.flow.trace.TraceMetadata; -public class TcpTraceReductionAnalysisWithThreads extends Analysis { +public class TcpTraceReductionAnalysisWithThreads extends OldAnalysis { private static final int NUM_VIRTUAL_CORES = Runtime.getRuntime().availableProcessors(); private static final int MIO = 1000000; diff --git a/src/test/java/teetime/variant/methodcallWithPorts/runtime/typeCheck/ConnectionTypeTest.java b/src/performancetest/java/teetime/runtime/typeCheck/ConnectionTypeTest.java similarity index 80% rename from src/test/java/teetime/variant/methodcallWithPorts/runtime/typeCheck/ConnectionTypeTest.java rename to src/performancetest/java/teetime/runtime/typeCheck/ConnectionTypeTest.java index f6472699e0680051eb2997a980b16dc364141979..827ff18feff3c598c829246fafcb4d2642b81ec8 100644 --- a/src/test/java/teetime/variant/methodcallWithPorts/runtime/typeCheck/ConnectionTypeTest.java +++ b/src/performancetest/java/teetime/runtime/typeCheck/ConnectionTypeTest.java @@ -1,4 +1,4 @@ -package teetime.variant.methodcallWithPorts.runtime.typeCheck; +package teetime.runtime.typeCheck; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -8,16 +8,16 @@ import java.lang.reflect.InvocationTargetException; import org.junit.Test; +import teetime.framework.pipe.IPipe; +import teetime.framework.pipe.PipeFactory; +import teetime.framework.pipe.PipeFactory.ThreadCommunication; +import teetime.stage.ObjectProducer; +import teetime.stage.PortTypeConfiguration; +import teetime.stage.StartTimestampFilter; +import teetime.stage.StopTimestampFilter; +import teetime.stage.basic.Sink; import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.methodcallWithPorts.framework.core.pipe.IPipe; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory; -import teetime.variant.methodcallWithPorts.framework.core.pipe.PipeFactory.ThreadCommunication; -import teetime.variant.methodcallWithPorts.stage.ObjectProducer; -import teetime.variant.methodcallWithPorts.stage.PortTypeConfiguration; -import teetime.variant.methodcallWithPorts.stage.StartTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.StopTimestampFilter; -import teetime.variant.methodcallWithPorts.stage.basic.Sink; +import teetime.util.TimestampObject; public class ConnectionTypeTest { @@ -28,7 +28,7 @@ public class ConnectionTypeTest { @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testDynamicPortConnection() throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, - IllegalArgumentException, InvocationTargetException, ClassNotFoundException { + IllegalArgumentException, InvocationTargetException, ClassNotFoundException { ConstructorClosure<TimestampObject> constructorClosure = new ConstructorClosure<TimestampObject>() { @Override public TimestampObject create() { @@ -60,7 +60,7 @@ public class ConnectionTypeTest { // System.out.println(typeVariable.getBounds()[0]); // ->class java.lang.Object // System.out.println(typeVariable.getName()); // ->T // System.out.println(typeVariable.getClass()); // ->class sun.reflect.generics.reflectiveObjects.TypeVariableImpl - // System.out.println(typeVariable.getGenericDeclaration()); // ->class teetime.variant.methodcallWithPorts.stage.ObjectProducer + // System.out.println(typeVariable.getGenericDeclaration()); // ->class teetime.stage.ObjectProducer // } // // Class<?> currentClass = objectProducer.getClass(); diff --git a/src/test/java/teetime/util/CircularCollectionsTest.java b/src/performancetest/java/teetime/util/CircularCollectionsTest.java similarity index 100% rename from src/test/java/teetime/util/CircularCollectionsTest.java rename to src/performancetest/java/teetime/util/CircularCollectionsTest.java diff --git a/src/test/java/teetime/util/StopWatchTest.java b/src/performancetest/java/teetime/util/StopWatchTest.java similarity index 100% rename from src/test/java/teetime/util/StopWatchTest.java rename to src/performancetest/java/teetime/util/StopWatchTest.java diff --git a/src/test/java/teetime/util/concurrent/CircularWorkStealingDequeTest.java b/src/performancetest/java/teetime/util/concurrent/CircularWorkStealingDequeTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/CircularWorkStealingDequeTest.java rename to src/performancetest/java/teetime/util/concurrent/CircularWorkStealingDequeTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithSentinelTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithSentinelTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithSentinelTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithSentinelTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithThreadLocalSentinelTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithThreadLocalSentinelTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithThreadLocalSentinelTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/CircularWorkStealingDequeWithThreadLocalSentinelTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/ExceptionalCircularWorkStealingDequeTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/ExceptionalCircularWorkStealingDequeTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/ExceptionalCircularWorkStealingDequeTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/ExceptionalCircularWorkStealingDequeTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/UntypedCircularWorkStealingDequeTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/UntypedCircularWorkStealingDequeTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/UntypedCircularWorkStealingDequeTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/UntypedCircularWorkStealingDequeTest.java diff --git a/src/test/java/teetime/util/concurrent/workstealing/alternative/UntypedExceptionalCircularWorkStealingDequeTest.java b/src/performancetest/java/teetime/util/concurrent/workstealing/alternative/UntypedExceptionalCircularWorkStealingDequeTest.java similarity index 100% rename from src/test/java/teetime/util/concurrent/workstealing/alternative/UntypedExceptionalCircularWorkStealingDequeTest.java rename to src/performancetest/java/teetime/util/concurrent/workstealing/alternative/UntypedExceptionalCircularWorkStealingDequeTest.java diff --git a/src/test/java/teetime/util/list/CommittableResizableArrayQueueTest.java b/src/performancetest/java/teetime/util/list/CommittableResizableArrayQueueTest.java similarity index 100% rename from src/test/java/teetime/util/list/CommittableResizableArrayQueueTest.java rename to src/performancetest/java/teetime/util/list/CommittableResizableArrayQueueTest.java diff --git a/src/test/data/load-logs/.gitignore b/src/test/data/load-logs/.gitignore index bc24c8c7ac1160c11bc3af787b571c732ad45123..c4e3e9be97070dc352e37d3d3514b6835bf9f5a0 100644 --- a/src/test/data/load-logs/.gitignore +++ b/src/test/data/load-logs/.gitignore @@ -1 +1,2 @@ /timings.txt +/timings-results.txt diff --git a/src/test/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysisTest.java b/src/test/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysisTest.java deleted file mode 100644 index 0de57c68917ee583c13e02e16cdec23dcb8bf02c..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/explicitScheduling/examples/recordReader/RecordReaderAnalysisTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.recordReader; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -import kieker.analysis.AnalysisController; -import kieker.analysis.IAnalysisController; -import kieker.analysis.IProjectContext; -import kieker.analysis.plugin.annotation.InputPort; -import kieker.analysis.plugin.filter.AbstractFilterPlugin; -import kieker.analysis.plugin.filter.forward.CountingFilter; -import kieker.analysis.plugin.filter.forward.ListCollectionFilter; -import kieker.analysis.plugin.reader.filesystem.FSReader; -import kieker.common.configuration.Configuration; -import kieker.common.record.IMonitoringRecord; -import kieker.common.util.registry.Registry; - -import org.junit.Assert; -import org.junit.Test; - -import teetime.variant.explicitScheduling.examples.recordReader.RecordReaderAnalysis; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistry; -import teetime.variant.explicitScheduling.stage.kieker.className.ClassNameRegistryRepository; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class RecordReaderAnalysisTest { - - private final static File INPUT_DIRECTORY = new File("examples/userguide/ch5--trace-monitoring-aspectj/testdata/kieker-20100830-082225522-UTC"); - - @Test - public void testExampleWithNewFramework() { - final List<IMonitoringRecord> records = new LinkedList<IMonitoringRecord>(); - - final RecordReaderAnalysis recordReaderAnalysis = new RecordReaderAnalysis(); - recordReaderAnalysis.init(); - recordReaderAnalysis.setInputFile(RecordReaderAnalysisTest.INPUT_DIRECTORY); - recordReaderAnalysis.setOutputRecordList(records); - recordReaderAnalysis.start(); - - final ClassNameRegistryRepository classNameRegistryRepository = recordReaderAnalysis.getClassNameRegistryRepository(); - Assert.assertEquals(1, classNameRegistryRepository.size()); - - final ClassNameRegistry classNameRegistry = classNameRegistryRepository.get(RecordReaderAnalysisTest.INPUT_DIRECTORY); - Assert.assertNotNull(classNameRegistry); - - Assert.assertEquals(2, classNameRegistry.size()); - Assert.assertEquals("kieker.common.record.misc.KiekerMetadataRecord", classNameRegistry.get(0)); - Assert.assertEquals("kieker.common.record.controlflow.OperationExecutionRecord", classNameRegistry.get(1)); - Assert.assertEquals(6541, records.size()); - Assert.assertEquals(1283156546127117246l, records.get(0).getLoggingTimestamp()); - } - - @Test - public void testExampleWithKiekerFramework() throws Exception { - final IAnalysisController ac = new AnalysisController(); - - final Configuration readerConfiguration = new Configuration(); - readerConfiguration.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, INPUT_DIRECTORY.getAbsolutePath()); - final FSReader reader = new FSReader(readerConfiguration, ac); - - final ListCollectionFilter<IMonitoringRecord> records = new ListCollectionFilter<IMonitoringRecord>(new Configuration(), ac); - final ClassNameRegistryFilter classNameRegistry = new ClassNameRegistryFilter(new Configuration(), ac); - - final CountingFilter countingFilter = new CountingFilter(new Configuration(), ac); - - ac.connect(reader, FSReader.OUTPUT_PORT_NAME_RECORDS, countingFilter, CountingFilter.INPUT_PORT_NAME_EVENTS); - ac.connect(reader, FSReader.OUTPUT_PORT_NAME_RECORDS, records, ListCollectionFilter.INPUT_PORT_NAME); - ac.connect(reader, FSReader.OUTPUT_PORT_NAME_RECORDS, classNameRegistry, ClassNameRegistryFilter.INPUT_PORT_NAME_RECORDS); - - ac.run(); - - // Keep in mind that the metadata record is not processed in a regular way - Assert.assertEquals(1, classNameRegistry.size()); - Assert.assertEquals("kieker.common.record.controlflow.OperationExecutionRecord", classNameRegistry.get(0)); - Assert.assertEquals(6540, countingFilter.getMessageCount()); - Assert.assertEquals(1283156545581511026L, records.getList().get(0).getLoggingTimestamp()); - } - - private static class ClassNameRegistryFilter extends AbstractFilterPlugin { - - public static final String INPUT_PORT_NAME_RECORDS = "input"; - - private final Registry<String> registry = new Registry<String>(); - - public ClassNameRegistryFilter(final Configuration configuration, final IProjectContext projectContext) { - super(configuration, projectContext); - } - - @InputPort(name = ClassNameRegistryFilter.INPUT_PORT_NAME_RECORDS, eventTypes = IMonitoringRecord.class) - public void input(final IMonitoringRecord record) { - this.registry.get(record.getClass().getName()); - } - - public Object get(final int id) { - return this.registry.get(id); - } - - public Object size() { - return this.registry.getSize(); - } - - @Override - public Configuration getCurrentConfiguration() { - return new Configuration(); - } - - } -} diff --git a/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysisTest.java b/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysisTest.java deleted file mode 100644 index d4fb3f2d1c56de010f7888d7363a97f6e53a96f4..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputAnalysisTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.throughput; - -import java.util.concurrent.Callable; - -import org.junit.Test; - -import teetime.util.StopWatch; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ThroughputAnalysisTest extends PerformanceTest { - - private static final int numRuns = 2; - - @Test - public void testWithMultipleRuns() { - final StopWatch stopWatch = new StopWatch(); - final long[] durations = new long[numRuns]; - - for (int i = 0; i < numRuns; i++) { - System.out.println("current run: " + i); - final ThroughputAnalysis<Object> analysis = new ThroughputAnalysis<Object>(); - analysis.setNumNoopFilters(800); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new Callable<Object>() { - @Override - public Object call() throws Exception { - return new Object(); - } - }); - analysis.init(); - - stopWatch.start(); - try { - analysis.start(); - } finally { - stopWatch.end(); - } - - durations[i] = stopWatch.getDurationInNs(); - } - - // for (final long dur : durations) { - // System.out.println("Duration: " + (dur / 1000) + " µs"); - // } - - long sum = 0; - for (int i = durations.length / 2; i < durations.length; i++) { - sum += durations[i]; - } - - final long avgDur = sum / (numRuns / 2); - System.out.println("avg duration: " + (avgDur / 1000) + " µs"); - } - -} diff --git a/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysisTest.java b/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysisTest.java deleted file mode 100644 index d6a3a39387720f101649e70875e3ba8b21c3b06a..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/explicitScheduling/examples/throughput/ThroughputTimestampAnalysisTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.explicitScheduling.examples.throughput; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; - -import org.junit.Test; - -import teetime.util.StopWatch; -import util.PerformanceTest; -import util.StatisticsUtil; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class ThroughputTimestampAnalysisTest extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - final StopWatch stopWatch = new StopWatch(); - final List<TimestampObject> timestampObjects = new ArrayList<TimestampObject>(NUM_OBJECTS_TO_CREATE); - - final ThroughputTimestampAnalysis analysis = new ThroughputTimestampAnalysis(); - analysis.setShouldUseQueue(true); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); // 4+n - analysis.setTimestampObjects(timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new Callable<TimestampObject>() { - @Override - public TimestampObject call() throws Exception { - return new TimestampObject(); - } - }); - analysis.init(); - - stopWatch.start(); - try { - analysis.start(); - } finally { - stopWatch.end(); - } - - StatisticsUtil.computeStatistics(stopWatch.getDurationInNs(), timestampObjects); - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/ChwComparisonMethodcall.java b/src/test/java/teetime/variant/methodcall/examples/ChwComparisonMethodcall.java deleted file mode 100644 index 084b8f39a9209f9e607b0f8bab25f22f07499219..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/ChwComparisonMethodcall.java +++ /dev/null @@ -1,80 +0,0 @@ -package teetime.variant.methodcall.examples; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; -import java.util.Map.Entry; - -import org.junit.AfterClass; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -import teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import teetime.variant.methodcall.examples.experiment02.MethodCallThoughputTimestampAnalysis2Test; -import teetime.variant.methodcall.examples.experiment03.MethodCallThoughputTimestampAnalysis3Test; -import teetime.variant.methodcall.examples.experiment04.MethodCallThoughputTimestampAnalysis4Test; -import teetime.variant.methodcall.examples.experiment05.MethodCallThoughputTimestampAnalysis5Test; -import teetime.variant.methodcall.examples.experiment06.MethodCallThoughputTimestampAnalysis6Test; -import teetime.variant.methodcall.examples.experiment07.MethodCallThoughputTimestampAnalysis7Test; -import teetime.variant.methodcall.examples.experiment08.MethodCallThoughputTimestampAnalysis8Test; -import teetime.variant.methodcall.examples.experiment12.MethodCallThoughputTimestampAnalysis12Test; -import teetime.variant.methodcall.examples.experiment13.MethodCallThoughputTimestampAnalysis13Test; -import util.PerformanceResult; -import util.PerformanceTest; - -@RunWith(Suite.class) -@SuiteClasses({ - MethodCallThoughputTimestampAnalysis1Test.class, - MethodCallThoughputTimestampAnalysis2Test.class, - MethodCallThoughputTimestampAnalysis3Test.class, - MethodCallThoughputTimestampAnalysis4Test.class, - MethodCallThoughputTimestampAnalysis5Test.class, - MethodCallThoughputTimestampAnalysis6Test.class, - MethodCallThoughputTimestampAnalysis7Test.class, - MethodCallThoughputTimestampAnalysis8Test.class, - MethodCallThoughputTimestampAnalysis12Test.class, - MethodCallThoughputTimestampAnalysis13Test.class, -}) -public class ChwComparisonMethodcall { - - @AfterClass - public static void doYourOneTimeTeardown() { - Map<String, PerformanceResult> performanceResults = PerformanceTest.measurementRepository.performanceResults; - for (Entry<String, PerformanceResult> entry : performanceResults.entrySet()) { - System.out.println("---> " + entry.getKey() + "\n" + entry.getValue()); - } - - PerformanceResult test1 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); - PerformanceResult test4 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment04.MethodCallThoughputTimestampAnalysis4Test)"); - PerformanceResult test7 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment07.MethodCallThoughputTimestampAnalysis7Test)"); - PerformanceResult test3 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment03.MethodCallThoughputTimestampAnalysis3Test)"); - PerformanceResult test8 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment08.MethodCallThoughputTimestampAnalysis8Test)"); - PerformanceResult test12 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment12.MethodCallThoughputTimestampAnalysis12Test)"); - PerformanceResult test13 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment13.MethodCallThoughputTimestampAnalysis13Test)"); - PerformanceResult test5 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment05.MethodCallThoughputTimestampAnalysis5Test)"); - PerformanceResult test2 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment02.MethodCallThoughputTimestampAnalysis2Test)"); - PerformanceResult test6 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment06.MethodCallThoughputTimestampAnalysis6Test)"); - - assertEquals(1, (double) test4.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(2, (double) test7.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(3, (double) test3.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(3, (double) test8.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(7, (double) test12.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(7, (double) test13.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(9, (double) test5.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(17, (double) test2.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(59, (double) test6.quantiles.get(0.5) / test1.quantiles.get(0.5), 1.1); - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/NieComparisonMethodcall.java b/src/test/java/teetime/variant/methodcall/examples/NieComparisonMethodcall.java deleted file mode 100644 index ba1ff285e143a6ec2a4be1b941b940c3d5d3c6d9..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/NieComparisonMethodcall.java +++ /dev/null @@ -1,80 +0,0 @@ -package teetime.variant.methodcall.examples; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; -import java.util.Map.Entry; - -import org.junit.AfterClass; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -import teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; -import teetime.variant.methodcall.examples.experiment02.MethodCallThoughputTimestampAnalysis2Test; -import teetime.variant.methodcall.examples.experiment03.MethodCallThoughputTimestampAnalysis3Test; -import teetime.variant.methodcall.examples.experiment04.MethodCallThoughputTimestampAnalysis4Test; -import teetime.variant.methodcall.examples.experiment05.MethodCallThoughputTimestampAnalysis5Test; -import teetime.variant.methodcall.examples.experiment06.MethodCallThoughputTimestampAnalysis6Test; -import teetime.variant.methodcall.examples.experiment07.MethodCallThoughputTimestampAnalysis7Test; -import teetime.variant.methodcall.examples.experiment08.MethodCallThoughputTimestampAnalysis8Test; -import teetime.variant.methodcall.examples.experiment12.MethodCallThoughputTimestampAnalysis12Test; -import teetime.variant.methodcall.examples.experiment13.MethodCallThoughputTimestampAnalysis13Test; -import util.PerformanceResult; -import util.PerformanceTest; - -@RunWith(Suite.class) -@SuiteClasses({ - MethodCallThoughputTimestampAnalysis1Test.class, - MethodCallThoughputTimestampAnalysis2Test.class, - MethodCallThoughputTimestampAnalysis3Test.class, - MethodCallThoughputTimestampAnalysis4Test.class, - MethodCallThoughputTimestampAnalysis5Test.class, - MethodCallThoughputTimestampAnalysis6Test.class, - MethodCallThoughputTimestampAnalysis7Test.class, - MethodCallThoughputTimestampAnalysis8Test.class, - MethodCallThoughputTimestampAnalysis12Test.class, - MethodCallThoughputTimestampAnalysis13Test.class, -}) -public class NieComparisonMethodcall { - - @AfterClass - public static void doYourOneTimeTeardown() { - Map<String, PerformanceResult> performanceResults = PerformanceTest.measurementRepository.performanceResults; - for (Entry<String, PerformanceResult> entry : performanceResults.entrySet()) { - System.out.println("---> " + entry.getKey() + "\n" + entry.getValue()); - } - - PerformanceResult test1 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test)"); - PerformanceResult test4 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment04.MethodCallThoughputTimestampAnalysis4Test)"); - PerformanceResult test7 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment07.MethodCallThoughputTimestampAnalysis7Test)"); - PerformanceResult test3 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment03.MethodCallThoughputTimestampAnalysis3Test)"); - PerformanceResult test8 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment08.MethodCallThoughputTimestampAnalysis8Test)"); - PerformanceResult test12 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment12.MethodCallThoughputTimestampAnalysis12Test)"); - PerformanceResult test13 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment13.MethodCallThoughputTimestampAnalysis13Test)"); - PerformanceResult test5 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment05.MethodCallThoughputTimestampAnalysis5Test)"); - PerformanceResult test2 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment02.MethodCallThoughputTimestampAnalysis2Test)"); - PerformanceResult test6 = performanceResults - .get("testWithManyObjects(teetime.variant.methodcall.examples.experiment06.MethodCallThoughputTimestampAnalysis6Test)"); - - assertEquals(1, (double) test4.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(2, (double) test7.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(4, (double) test3.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(4, (double) test8.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(8, (double) test12.quantiles.get(0.5) / test1.quantiles.get(0.5), 1.1); - assertEquals(8, (double) test13.quantiles.get(0.5) / test1.quantiles.get(0.5), 1.1); - assertEquals(10, (double) test5.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(17, (double) test2.quantiles.get(0.5) / test1.quantiles.get(0.5), 0.1); - assertEquals(65, (double) test6.quantiles.get(0.5) / test1.quantiles.get(0.5), 1.1); - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThoughputTimestampAnalysis2Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThoughputTimestampAnalysis2Test.java deleted file mode 100644 index a8f7c0012a8d87ffa1a43528bc8c7f2f3de7f054..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThoughputTimestampAnalysis2Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment02; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis2Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis2 analysis = new MethodCallThroughputAnalysis2(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThroughputAnalysis2.java b/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThroughputAnalysis2.java deleted file mode 100644 index 4baa051d63747a980130cfacf5a5db0b0ec8362e..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment02/MethodCallThroughputAnalysis2.java +++ /dev/null @@ -1,115 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment02; - -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.util.list.CommittableQueue; -import teetime.util.list.CommittableResizableArrayQueue; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Pipeline; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis2 extends Analysis { - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final Pipeline<Void, Object> pipeline = new Pipeline<Void, Object>(); - pipeline.setFirstStage(objectProducer); - pipeline.addIntermediateStage(startTimestampFilter); - pipeline.addIntermediateStages(noopFilters); - pipeline.addIntermediateStage(stopTimestampFilter); - pipeline.setLastStage(collectorSink); - - pipeline.onStart(); - - final Runnable runnable = new Runnable() { - @Override - public void run() { - CommittableQueue<Void> inputQueue = new CommittableResizableArrayQueue<Void>(null, 0); - do { - pipeline.execute2(inputQueue); - } while (pipeline.isReschedulable()); - } - }; - - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThoughputTimestampAnalysis3Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThoughputTimestampAnalysis3Test.java deleted file mode 100644 index f0254708c07660dcafabade22626179cb7930cba..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThoughputTimestampAnalysis3Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment03; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis3Test extends PerformanceTest { - - // 500 times faster than our new framework - // TODO check why - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis3 analysis = new MethodCallThroughputAnalysis3(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThroughputAnalysis3.java b/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThroughputAnalysis3.java deleted file mode 100644 index 1f905d129e654c01332f3a97066f6fbbb50eee63..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment03/MethodCallThroughputAnalysis3.java +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment03; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis3 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final List<Stage<?, ?>> stageList = new ArrayList<Stage<?, ?>>(); - stageList.add(objectProducer); - stageList.add(startTimestampFilter); - stageList.addAll(Arrays.asList(noopFilters)); - stageList.add(stopTimestampFilter); - stageList.add(collectorSink); - - // using an array decreases the performance from 60ms to 200ms (by 3x) - final Stage<?, ?>[] stages = stageList.toArray(new Stage[0]); - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - // extracting the null-check does NOT improve performance - // Stage stage = stages[0]; - // Object element = stage.execute(null); - // if (element == null) { - // return false; - // } - - Object element = null; - - for (int i = 0; i < stages.length; i++) { - Stage<?, ?> stage = stages[i]; - element = stage.execute(element); - if (element == null) { - return false; - } - } - - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThoughputTimestampAnalysis4Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThoughputTimestampAnalysis4Test.java deleted file mode 100644 index bc5b0ea55f127de455d2fcf8448d7e5d095ffbc6..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThoughputTimestampAnalysis4Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment04; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis4Test extends PerformanceTest { - - // 500 times faster than our new framework - // TODO check why - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis4 analysis = new MethodCallThroughputAnalysis4(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThroughputAnalysis4.java b/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThroughputAnalysis4.java deleted file mode 100644 index 35983c03870ddfc84c7638f80b7d6c4b7955431a..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment04/MethodCallThroughputAnalysis4.java +++ /dev/null @@ -1,137 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment04; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis4 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - List<Stage> stages = new ArrayList<Stage>(); - stages.add(objectProducer); - stages.add(startTimestampFilter); - stages.addAll(Arrays.asList(noopFilters)); - stages.add(stopTimestampFilter); - stages.add(collectorSink); - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - TimestampObject object = objectProducer.execute(null); - if (object == null) { - return false; - } - object = startTimestampFilter.execute(object); - for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { - object = noopFilter.execute(object); - } - - object = stopTimestampFilter.execute(object); - collectorSink.execute(object); - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThoughputTimestampAnalysis5Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThoughputTimestampAnalysis5Test.java deleted file mode 100644 index 6922fc2a8d346cfc192a2c688c979518ef73b574..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThoughputTimestampAnalysis5Test.java +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment05; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis5Test extends PerformanceTest { - - // 500 times faster than our new framework - // TODO check why - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis5 analysis = new MethodCallThroughputAnalysis5(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThroughputAnalysis5.java b/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThroughputAnalysis5.java deleted file mode 100644 index 176f09efed5c06a6dbb5fb2ccb4102c70debf9d9..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment05/MethodCallThroughputAnalysis5.java +++ /dev/null @@ -1,146 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment05; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis5 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private Runnable buildPipeline() { - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final List<Stage> stageList = new ArrayList<Stage>(); - stageList.add(objectProducer); - stageList.add(startTimestampFilter); - stageList.addAll(Arrays.asList(noopFilters)); - stageList.add(stopTimestampFilter); - stageList.add(collectorSink); - - // using an array decreases the performance from 60ms to 440ms (by 7x) - final Stage[] stages = stageList.toArray(new Stage[0]); - for (int i = 0; i < stages.length - 1; i++) { - stages[i].setSuccessor(stages[i + 1]); - } - final Stage startStage = stages[0]; - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - Object element = null; - Stage stage = startStage; - - element = stage.execute(element); - if (element == null) { - return false; - } - stage = stage.next(); - - do { - element = stage.execute(element); - stage = stage.next(); - } while (stage != null); - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThoughputTimestampAnalysis6Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThoughputTimestampAnalysis6Test.java deleted file mode 100644 index 7971dfa4a4a12a644238db0fbc79f2830021d084..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThoughputTimestampAnalysis6Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment06; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis6Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis6 analysis = new MethodCallThroughputAnalysis6(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThroughputAnalysis6.java b/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThroughputAnalysis6.java deleted file mode 100644 index 04faa04853c529fea0aa91881c4a54cb211f147a..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment06/MethodCallThroughputAnalysis6.java +++ /dev/null @@ -1,939 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment06; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis6 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - List<Stage> stages = new ArrayList<Stage>(); - stages.add(objectProducer); - stages.add(startTimestampFilter); - stages.addAll(Arrays.asList(noopFilters)); - stages.add(stopTimestampFilter); - stages.add(collectorSink); - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - TimestampObject object = objectProducer.execute(null); - if (object == null) { - return false; - } - object = startTimestampFilter.execute(object); - // for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { - // object = noopFilter.execute(object); - // } - - int i = 0; - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - object = noopFilters[i++].execute(object); - - object = stopTimestampFilter.execute(object); - collectorSink.execute(object); - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThoughputTimestampAnalysis7Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThoughputTimestampAnalysis7Test.java deleted file mode 100644 index 77249c1d270bf8ef6280bf612ed14b6146a90ca4..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThoughputTimestampAnalysis7Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment07; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis7Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis7 analysis = new MethodCallThroughputAnalysis7(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThroughputAnalysis7.java b/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThroughputAnalysis7.java deleted file mode 100644 index 29f51446d230e3478c75dc4315d9ac7f0651d872..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment07/MethodCallThroughputAnalysis7.java +++ /dev/null @@ -1,149 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment07; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.AbstractStage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis7 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - @SuppressWarnings("rawtypes") - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final List<AbstractStage> stageList = new ArrayList<AbstractStage>(); - stageList.add(objectProducer); - stageList.add(startTimestampFilter); - stageList.addAll(Arrays.asList(noopFilters)); - stageList.add(stopTimestampFilter); - stageList.add(collectorSink); - - // using an array decreases the performance from 60ms to 200ms (by 3x) - final AbstractStage[] stages = stageList.toArray(new AbstractStage[0]); - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - // using the foreach for arrays (i.e., w/o using an iterator variable) increases the performance from 200ms to 130ms - Object element = null; - for (AbstractStage stage : stages) { - element = stage.execute(element); - if (element == null) { - return false; - } - } - - // changing the type of stages decreases performance by 2 (e.g., NoopFilter -> Stage) - // the VM seems to not optimize the code anymore if the concrete type is not declared - - // for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { - // element = noopFilter.execute(element); - // } - // - // element = stopTimestampFilter.execute(element); - // element = collectorSink.execute(element); - - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThoughputTimestampAnalysis8Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThoughputTimestampAnalysis8Test.java deleted file mode 100644 index c46ae4e173f7512a81ad97db5164c4d7e4b79f26..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThoughputTimestampAnalysis8Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment08; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis8Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis8 analysis = new MethodCallThroughputAnalysis8(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThroughputAnalysis8.java b/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThroughputAnalysis8.java deleted file mode 100644 index 90c034ebc545476c864b0631f26379f9ea1d2bab..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment08/MethodCallThroughputAnalysis8.java +++ /dev/null @@ -1,152 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment08; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.AbstractStage; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis8 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private int numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final List<AbstractStage<?, ?>> stageList = new ArrayList<AbstractStage<?, ?>>(); - stageList.add(objectProducer); - stageList.add(startTimestampFilter); - stageList.addAll(Arrays.asList(noopFilters)); - stageList.add(stopTimestampFilter); - stageList.add(collectorSink); - - // using an array decreases the performance from 60ms to 200ms (by 3x) - final AbstractStage<?, ?>[] stages = stageList.toArray(new AbstractStage[0]); - - final WrappingPipeline pipeline = new WrappingPipeline() { - private int startIndex; - - @Override - public boolean execute() { - // using the foreach for arrays (i.e., w/o using an iterator variable) increases the performance from 200ms to 130ms - Object element = null; - for (int i = this.startIndex; i < stages.length; i++) { - Stage<?, ?> stage = stages[i]; - element = stage.execute(element); - if (element == null) { - return false; - } - } - - // changing the type of stages decreases performance by 2 (e.g., NoopFilter -> Stage) - // the VM seems to not optimize the code anymore if the concrete type is not declared - - // for (final NoopFilter<TimestampObject> noopFilter : noopFilters) { - // element = noopFilter.execute(element); - // } - // - // element = stopTimestampFilter.execute(element); - // element = collectorSink.execute(element); - - return true; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThoughputTimestampAnalysis12Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThoughputTimestampAnalysis12Test.java deleted file mode 100644 index 61207a67726dfbe45673f88200f8f7d407444c0e..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThoughputTimestampAnalysis12Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment12; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis12Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis12 analysis = new MethodCallThroughputAnalysis12(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThroughputAnalysis12.java b/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThroughputAnalysis12.java deleted file mode 100644 index 399ccc27c540c47841b20eed454662bd30938338..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment12/MethodCallThroughputAnalysis12.java +++ /dev/null @@ -1,113 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment12; - -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.Pipeline; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis12 extends Analysis { - - private long numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - private Runnable buildPipeline() { - @SuppressWarnings("unchecked") - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final Pipeline<Void, Object> pipeline = new Pipeline<Void, Object>(); - pipeline.setFirstStage(objectProducer); - pipeline.addIntermediateStage(startTimestampFilter); - pipeline.addIntermediateStages(noopFilters); - pipeline.addIntermediateStage(stopTimestampFilter); - pipeline.setLastStage(collectorSink); - - pipeline.onStart(); - - final Runnable runnable = new Runnable() { - @Override - public void run() { - Object result; - do { - result = pipeline.executeRecursively(null); - } while (result != null); - } - }; - - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThoughputTimestampAnalysis13Test.java b/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThoughputTimestampAnalysis13Test.java deleted file mode 100644 index d0d50d5b128387179c012d5815a7b52f191a5b37..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThoughputTimestampAnalysis13Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment13; - -import org.junit.Test; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import util.PerformanceTest; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThoughputTimestampAnalysis13Test extends PerformanceTest { - - @Test - public void testWithManyObjects() { - System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" - + NUM_NOOP_FILTERS + "..."); - - final MethodCallThroughputAnalysis13 analysis = new MethodCallThroughputAnalysis13(); - analysis.setNumNoopFilters(NUM_NOOP_FILTERS); - analysis.setTimestampObjects(this.timestampObjects); - analysis.setInput(NUM_OBJECTS_TO_CREATE, new ConstructorClosure<TimestampObject>() { - @Override - public TimestampObject create() { - return new TimestampObject(); - } - }); - analysis.init(); - - this.stopWatch.start(); - try { - analysis.start(); - } finally { - this.stopWatch.end(); - } - } - -} diff --git a/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThroughputAnalysis13.java b/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThroughputAnalysis13.java deleted file mode 100644 index edd8b95ebf3acfb59ce3556639a406df33d4d2e1..0000000000000000000000000000000000000000 --- a/src/test/java/teetime/variant/methodcall/examples/experiment13/MethodCallThroughputAnalysis13.java +++ /dev/null @@ -1,138 +0,0 @@ -/*************************************************************************** - * 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 teetime.variant.methodcall.examples.experiment13; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import teetime.util.ConstructorClosure; -import teetime.variant.explicitScheduling.examples.throughput.TimestampObject; -import teetime.variant.explicitScheduling.framework.core.Analysis; -import teetime.variant.methodcall.framework.core.AbstractStage; -import teetime.variant.methodcall.framework.core.Stage; -import teetime.variant.methodcall.stage.CollectorSink; -import teetime.variant.methodcall.stage.EndStage; -import teetime.variant.methodcall.stage.NoopFilter; -import teetime.variant.methodcall.stage.ObjectProducer; -import teetime.variant.methodcall.stage.StartTimestampFilter; -import teetime.variant.methodcall.stage.StopTimestampFilter; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class MethodCallThroughputAnalysis13 extends Analysis { - - public abstract class WrappingPipeline { - - public abstract boolean execute(); - - } - - private long numInputObjects; - private ConstructorClosure<TimestampObject> inputObjectCreator; - private int numNoopFilters; - private List<TimestampObject> timestampObjects; - private Runnable runnable; - - @Override - public void init() { - super.init(); - this.runnable = this.buildPipeline(); - } - - /** - * @param numNoopFilters - * @since 1.10 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - private Runnable buildPipeline() { - final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; - // create stages - final ObjectProducer<TimestampObject> objectProducer = new ObjectProducer<TimestampObject>(this.numInputObjects, this.inputObjectCreator); - final StartTimestampFilter startTimestampFilter = new StartTimestampFilter(); - for (int i = 0; i < noopFilters.length; i++) { - noopFilters[i] = new NoopFilter<TimestampObject>(); - } - final StopTimestampFilter stopTimestampFilter = new StopTimestampFilter(); - final CollectorSink<TimestampObject> collectorSink = new CollectorSink<TimestampObject>(this.timestampObjects); - - final List<AbstractStage> stageList = new ArrayList<AbstractStage>(); - stageList.add(objectProducer); - stageList.add(startTimestampFilter); - stageList.addAll(Arrays.asList(noopFilters)); - stageList.add(stopTimestampFilter); - stageList.add(collectorSink); - - // using an array decreases the performance from 60ms to 200ms (by 3x) - final AbstractStage[] stages = stageList.toArray(new AbstractStage[0]); - - for (int i = 0; i < stages.length - 1; i++) { - Stage<?, ?> stage = stages[i]; - stage.setSuccessor(stages[i + 1]); - } - stages[stages.length - 1].setSuccessor(new EndStage<Object>()); - - final WrappingPipeline pipeline = new WrappingPipeline() { - @Override - public boolean execute() { - Object result = stages[0].executeRecursively(null); - return result != null; - } - - }; - - final Runnable runnable = new Runnable() { - @Override - public void run() { - boolean success; - do { - success = pipeline.execute(); - } while (success); - } - }; - return runnable; - } - - @Override - public void start() { - super.start(); - this.runnable.run(); - } - - public void setInput(final int numInputObjects, final ConstructorClosure<TimestampObject> inputObjectCreator) { - this.numInputObjects = numInputObjects; - this.inputObjectCreator = inputObjectCreator; - } - - public int getNumNoopFilters() { - return this.numNoopFilters; - } - - public void setNumNoopFilters(final int numNoopFilters) { - this.numNoopFilters = numNoopFilters; - } - - public List<TimestampObject> getTimestampObjects() { - return this.timestampObjects; - } - - public void setTimestampObjects(final List<TimestampObject> timestampObjects) { - this.timestampObjects = timestampObjects; - } -} diff --git a/src/test/resources/logback-test.groovy b/src/test/resources/logback-test.groovy index 23fb52cc7cb9f7124829f42562d8e7e8b016d41c..b156267877d2adb27470de0d9b9e58c7d6d116a8 100644 --- a/src/test/resources/logback-test.groovy +++ b/src/test/resources/logback-test.groovy @@ -21,4 +21,5 @@ appender("CONSOLE", ConsoleAppender) { root ERROR, ["CONSOLE"] +logger "teetime.variant.methodcallWithPorts.stage", INFO logger "util", INFO \ No newline at end of file