Skip to content
Snippets Groups Projects
Commit ad77aa32 authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

Merge remote-tracking branch 'origin/master' into release

Conflicts:
	pom.xml
parents c0e07e1f dd24f919
Branches
Tags
No related merge requests found
Showing
with 71 additions and 543 deletions
...@@ -13,16 +13,22 @@ ...@@ -13,16 +13,22 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package teetime.examples.experiment09; package teetime.examples.experiment09pipeimpls;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import teetime.framework.pipe.CommittablePipeFactory;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.OrderedGrowableArrayPipeFactory;
import teetime.framework.pipe.SingleElementPipeFactory;
import teetime.framework.pipe.UnorderedGrowablePipeFactory;
import teetime.util.ConstructorClosure; import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject; import teetime.util.TimestampObject;
import util.test.PerformanceTest;
import util.test.AbstractProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
import util.test.PerformanceTest;
/** /**
* @author Christian Wulf * @author Christian Wulf
...@@ -35,16 +41,40 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { ...@@ -35,16 +41,40 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest {
public static void beforeClass() { public static void beforeClass() {
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwWorkPerformanceCheck()); PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwWorkPerformanceCheck());
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwHomePerformanceCheck()); PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis9Test.class, new ChwHomePerformanceCheck());
}; }
@AfterClass @AfterClass
public static void afterClass() { public static void afterClass() {
AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class);
performanceCheckProfile.check(); performanceCheckProfile.check();
}; }
@Test @Test
public void testWithManyObjects() { public void testCommittablePipes() throws Exception {
IPipeFactory pipeFactory = new CommittablePipeFactory();
testWithManyObjects(pipeFactory);
}
@Test
public void testSingleElementPipes() throws Exception {
IPipeFactory pipeFactory = new SingleElementPipeFactory();
testWithManyObjects(pipeFactory);
}
@Test
public void testOrderedGrowableArrayPipes() throws Exception {
IPipeFactory pipeFactory = new OrderedGrowableArrayPipeFactory();
testWithManyObjects(pipeFactory);
}
@Ignore
@Test
public void testUnorderedGrowablePipes() throws Exception { // TODO remove test 11
IPipeFactory pipeFactory = new UnorderedGrowablePipeFactory();
testWithManyObjects(pipeFactory);
}
private void testWithManyObjects(final IPipeFactory pipeFactory) {
System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS=" System.out.println("Testing teetime (mc) with NUM_OBJECTS_TO_CREATE=" + NUM_OBJECTS_TO_CREATE + ", NUM_NOOP_FILTERS="
+ NUM_NOOP_FILTERS + "..."); + NUM_NOOP_FILTERS + "...");
...@@ -57,7 +87,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { ...@@ -57,7 +87,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest {
return new TimestampObject(); return new TimestampObject();
} }
}); });
analysis.init(); analysis.init(pipeFactory);
this.stopWatch.start(); this.stopWatch.start();
try { try {
......
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package teetime.examples.experiment09; package teetime.examples.experiment09pipeimpls;
import java.util.List; import java.util.List;
import teetime.framework.Stage;
import teetime.framework.OldHeadPipeline; import teetime.framework.OldHeadPipeline;
import teetime.framework.RunnableProducerStage; import teetime.framework.RunnableProducerStage;
import teetime.framework.pipe.CommittablePipe; import teetime.framework.Stage;
import teetime.framework.pipe.IPipeFactory;
import teetime.stage.CollectorSink; import teetime.stage.CollectorSink;
import teetime.stage.NoopFilter; import teetime.stage.NoopFilter;
import teetime.stage.ObjectProducer; import teetime.stage.ObjectProducer;
...@@ -42,17 +42,18 @@ public class MethodCallThroughputAnalysis9 { ...@@ -42,17 +42,18 @@ public class MethodCallThroughputAnalysis9 {
private List<TimestampObject> timestampObjects; private List<TimestampObject> timestampObjects;
private Runnable runnable; private Runnable runnable;
public void init() { public void init(final IPipeFactory pipeFactory) {
Stage pipeline = this.buildPipeline(); Stage pipeline = this.buildPipeline(pipeFactory);
this.runnable = new RunnableProducerStage(pipeline); this.runnable = new RunnableProducerStage(pipeline);
} }
/** /**
* @param pipeFactory
* @param numNoopFilters * @param numNoopFilters
* @return * @return
* @since 1.10 * @since 1.10
*/ */
private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline() { private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final IPipeFactory pipeFactory) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters]; final NoopFilter<TimestampObject>[] noopFilters = new NoopFilter[this.numNoopFilters];
// create stages // create stages
...@@ -68,13 +69,13 @@ public class MethodCallThroughputAnalysis9 { ...@@ -68,13 +69,13 @@ public class MethodCallThroughputAnalysis9 {
pipeline.setFirstStage(objectProducer); pipeline.setFirstStage(objectProducer);
pipeline.setLastStage(collectorSink); pipeline.setLastStage(collectorSink);
CommittablePipe.connect(objectProducer.getOutputPort(), startTimestampFilter.getInputPort()); pipeFactory.create(objectProducer.getOutputPort(), startTimestampFilter.getInputPort());
CommittablePipe.connect(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort()); pipeFactory.create(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort());
for (int i = 0; i < noopFilters.length - 1; i++) { for (int i = 0; i < noopFilters.length - 1; i++) {
CommittablePipe.connect(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort()); pipeFactory.create(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort());
} }
CommittablePipe.connect(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort()); pipeFactory.create(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort());
CommittablePipe.connect(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort()); pipeFactory.create(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort());
return pipeline; return pipeline;
} }
......
package teetime.examples.experiment10;
import static org.junit.Assert.assertEquals;
class ChwHomePerformanceCheck extends AbstractPerformanceCheck {
@Override
public String getCorrespondingPerformanceProfile() {
return "ChwHome";
}
@Override
public void check() {
super.check();
double medianSpeedup = (double) test10.quantiles.get(0.5) / test01.quantiles.get(0.5);
System.out.println("meanSpeedup (10): " + medianSpeedup);
// since 26.06.2014 (incl.)
// assertEquals(26, value10, 2.1); // +14
// // since 04.07.2014 (incl.)
// assertEquals(26, value10, 2.1); // +0
// since 11.08.2014 (incl.)
// assertEquals(47, value10, 2.1); // +21
// since 31.08.2014 (incl.)
// assertEquals(51, medianSpeedup, 3.2); // +4
// since 13.12.2014 (incl.)
assertEquals(40, medianSpeedup, 3.2); // -11
}
}
package teetime.examples.experiment10;
import static org.junit.Assert.assertEquals;
class ChwWorkPerformanceCheck extends AbstractPerformanceCheck {
@Override
public String getCorrespondingPerformanceProfile() {
return "ChwWork";
}
@Override
public void check() {
super.check();
double medianSpeedup = (double) test10.quantiles.get(0.5) / test01.quantiles.get(0.5);
System.out.println("medianSpeedup (10): " + medianSpeedup);
// until 25.06.2014 (incl.)
// assertEquals(14, (double) test10.quantiles.get(0.5) / test1.quantiles.get(0.5), 2.1);
// since 26.06.2014 (incl.)
// assertEquals(26, meanSpeedup, 2.1); // +14
// since 04.07.2014 (incl.)
// assertEquals(26, meanSpeedup, 2.1); // +0
// since 27.08.2014 (incl.)
// assertEquals(56, meanSpeedup, 2.1); // +30
// since 14.10.2014 (incl.)
assertEquals(25, medianSpeedup, 3.1); // -31
}
}
/***************************************************************************
* 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.examples.experiment10;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject;
import util.test.PerformanceTest;
import util.test.AbstractProfiledPerformanceAssertion;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest {
@BeforeClass
public static void beforeClass() {
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis10Test.class, new ChwWorkPerformanceCheck());
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis10Test.class, new ChwHomePerformanceCheck());
};
@AfterClass
public static void afterClass() {
AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class);
performanceCheckProfile.check();
};
@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 MethodCallThroughputAnalysis10 analysis = new MethodCallThroughputAnalysis10();
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();
}
}
}
/***************************************************************************
* 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.examples.experiment10;
import java.util.List;
import teetime.framework.OldHeadPipeline;
import teetime.framework.RunnableProducerStage;
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.util.TimestampObject;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class MethodCallThroughputAnalysis10 {
private long numInputObjects;
private ConstructorClosure<TimestampObject> inputObjectCreator;
private int numNoopFilters;
private List<TimestampObject> timestampObjects;
private Runnable runnable;
public void 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 OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> pipeline = new OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>>();
pipeline.setFirstStage(objectProducer);
pipeline.setLastStage(collectorSink);
SingleElementPipe.connect(objectProducer.getOutputPort(), startTimestampFilter.getInputPort());
SingleElementPipe.connect(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort());
for (int i = 0; i < noopFilters.length - 1; i++) {
SingleElementPipe.connect(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort());
}
SingleElementPipe.connect(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort());
SingleElementPipe.connect(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort());
return new RunnableProducerStage(pipeline);
}
public void 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;
}
}
package teetime.examples.experiment11; package teetime.examples.experiment11;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import teetime.examples.HostName;
import util.test.AbstractProfiledPerformanceAssertion;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
import util.test.AbstractProfiledPerformanceAssertion;
class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
return "ChwHome"; return HostName.CHW_HOME.toString();
} }
@Override @Override
......
package teetime.examples.experiment14;
import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test;
import util.test.MeasurementRepository;
import util.test.PerformanceResult;
import util.test.PerformanceTest;
import util.test.AbstractProfiledPerformanceAssertion;
abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion {
protected PerformanceResult test01;
protected PerformanceResult test14;
@Override
public void check() {
String testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis1Test.class, "testWithManyObjects");
test01 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier);
testMethodIdentifier = MeasurementRepository.buildTestMethodIdentifier(MethodCallThoughputTimestampAnalysis14Test.class, "testWithManyObjects");
test14 = PerformanceTest.measurementRepository.performanceResults.get(testMethodIdentifier);
}
}
package teetime.examples.experiment14;
import static org.junit.Assert.assertEquals;
class ChwHomePerformanceCheck extends AbstractPerformanceCheck {
@Override
public String getCorrespondingPerformanceProfile() {
return "ChwHome";
}
@Override
public void check() {
super.check();
double medianSpeedup = (double) test14.quantiles.get(0.5) / test01.quantiles.get(0.5);
System.out.println("medianSpeedup (14): " + medianSpeedup);
// until 25.06.2014 (incl.)
// assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1);
// since 26.06.2014 (incl.)
// assertEquals(76, medianSpeedup, 5.1); // +16
// since 04.07.2014 (incl.)
// assertEquals(86, medianSpeedup, 5.1); // +16
// since 11.08.2014 (incl.)
// assertEquals(103, medianSpeedup, 5.1); // +17
// since 31.08.2014 (incl.)
// assertEquals(62, medianSpeedup, 2.1); // -41
// since 04.11.2014 (incl.)
// assertEquals(84, medianSpeedup, 2.1); // +22
// since 05.12.2014 (incl.)
// assertEquals(75, medianSpeedup, 2.1); // -9
// since 13.12.2014 (incl.)
assertEquals(44, medianSpeedup, 2.1); // -31
}
}
package teetime.examples.experiment14;
import static org.junit.Assert.assertEquals;
class ChwWorkPerformanceCheck extends AbstractPerformanceCheck {
@Override
public String getCorrespondingPerformanceProfile() {
return "ChwWork";
}
@Override
public void check() {
super.check();
double medianSpeedup = (double) test14.quantiles.get(0.5) / test01.quantiles.get(0.5);
System.out.println("medianSpeedup (14): " + medianSpeedup);
// until 25.06.2014 (incl.)
// assertEquals(60, (double) test14.quantiles.get(0.5) / test1.quantiles.get(0.5), 5.1);
// since 26.06.2014 (incl.)
// assertEquals(76, medianSpeedup, 5.1); // +16
// since 04.07.2014 (incl.)
// assertEquals(86, medianSpeedup, 5.1); // +16
// since 27.08.2014 (incl.)
// assertEquals(102, medianSpeedup, 5.1); // +16
// since 14.10.2014 (incl.)
// assertEquals(81, medianSpeedup, 5.1); // -21
// since 19.12.2014 (incl.)
assertEquals(56, medianSpeedup, 5.1); // -25
}
}
/***************************************************************************
* 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.examples.experiment14;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import teetime.util.ConstructorClosure;
import teetime.util.TimestampObject;
import util.test.PerformanceTest;
import util.test.AbstractProfiledPerformanceAssertion;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class MethodCallThoughputTimestampAnalysis14Test extends PerformanceTest {
@BeforeClass
public static void beforeClass() {
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis14Test.class, new ChwWorkPerformanceCheck());
PERFORMANCE_CHECK_PROFILE_REPOSITORY.register(MethodCallThoughputTimestampAnalysis14Test.class, new ChwHomePerformanceCheck());
};
@AfterClass
public static void afterClass() {
AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class);
performanceCheckProfile.check();
};
@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 MethodCallThroughputAnalysis14 analysis = new MethodCallThroughputAnalysis14();
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();
}
}
}
/***************************************************************************
* 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.examples.experiment14;
import java.util.List;
import teetime.framework.Stage;
import teetime.framework.OldHeadPipeline;
import teetime.framework.RunnableProducerStage;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.PipeFactoryRegistry;
import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
import teetime.framework.pipe.PipeFactoryRegistry.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.util.TimestampObject;
/**
* @author Christian Wulf
*
* @since 1.10
*/
public class MethodCallThroughputAnalysis14 {
private long numInputObjects;
private ConstructorClosure<TimestampObject> inputObjectCreator;
private int numNoopFilters;
private List<TimestampObject> timestampObjects;
private Runnable runnable;
private final PipeFactoryRegistry pipeFactory = PipeFactoryRegistry.INSTANCE;
public void init() {
Stage pipeline = this.buildPipeline();
this.runnable = new RunnableProducerStage(pipeline);
}
/**
* @param numNoopFilters
* @return
* @since 1.10
*/
private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> 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 OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> pipeline = new OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>>();
pipeline.setFirstStage(objectProducer);
pipeline.setLastStage(collectorSink);
IPipeFactory factory = this.pipeFactory.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.QUEUE_BASED, true);
factory.create(objectProducer.getOutputPort(), startTimestampFilter.getInputPort());
factory.create(startTimestampFilter.getOutputPort(), noopFilters[0].getInputPort());
for (int i = 0; i < noopFilters.length - 1; i++) {
factory.create(noopFilters[i].getOutputPort(), noopFilters[i + 1].getInputPort());
}
factory.create(noopFilters[noopFilters.length - 1].getOutputPort(), stopTimestampFilter.getInputPort());
factory.create(stopTimestampFilter.getOutputPort(), collectorSink.getInputPort());
return pipeline;
}
public void 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;
}
}
package teetime.examples.experiment16; package teetime.examples.experiment16;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import teetime.examples.HostName;
import util.test.AbstractProfiledPerformanceAssertion; import util.test.AbstractProfiledPerformanceAssertion;
import util.test.PerformanceResult; import util.test.PerformanceResult;
import util.test.PerformanceTest; import util.test.PerformanceTest;
...@@ -9,7 +10,7 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { ...@@ -9,7 +10,7 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
@Override @Override
public String getCorrespondingPerformanceProfile() { public String getCorrespondingPerformanceProfile() {
return "ChwHome"; return HostName.CHW_HOME.toString();
} }
@Override @Override
...@@ -21,11 +22,11 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { ...@@ -21,11 +22,11 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults PerformanceResult test16c = PerformanceTest.measurementRepository.performanceResults
.get("testWithManyObjectsAnd4Threads(" + MethodCallThoughputTimestampAnalysis16Test.class.getName() + ")"); .get("testWithManyObjectsAnd4Threads(" + MethodCallThoughputTimestampAnalysis16Test.class.getName() + ")");
// check speedup // check speedup
double speedupB = (double) test16a.overallDurationInNs / test16b.overallDurationInNs; double speedupA2B = (double) test16a.overallDurationInNs / test16b.overallDurationInNs;
double speedupC = (double) test16a.overallDurationInNs / test16c.overallDurationInNs; double speedupB2C = (double) test16b.overallDurationInNs / test16c.overallDurationInNs;
System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupB: " + speedupB); System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupB: " + speedupA2B);
System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupC: " + speedupC); System.out.println(ChwHomePerformanceCheck.class.getName() + ", speedupC: " + speedupB2C);
// assertEquals(2, speedupB, 0.3); // assertEquals(2, speedupB, 0.3);
// since 31.08.2014 (incl.) // since 31.08.2014 (incl.)
...@@ -33,7 +34,10 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { ...@@ -33,7 +34,10 @@ class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion {
// since 04.11.2014 (incl.) // since 04.11.2014 (incl.)
// assertEquals(5, speedupC, 0.4); // assertEquals(5, speedupC, 0.4);
// since 07.12.2014 (incl.) // since 07.12.2014 (incl.)
assertEquals(2, speedupB, 0.4); // assertEquals(2, speedupA2B, 0.4);
assertEquals(5, speedupC, 0.4); // assertEquals(5, speedupB2C, 0.4);
// since 28.12.2014 (incl.)
assertEquals(2, speedupA2B, 0.4);
assertEquals(2, speedupB2C, 0.4);
} }
} }
...@@ -58,13 +58,13 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> exte ...@@ -58,13 +58,13 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> exte
} }
@Override @Override
public void setOwningThread(final Thread owningThread) { public Thread getOwningThread() {
firstStage.setOwningThread(owningThread); return firstStage.getOwningThread();
} }
@Override @Override
public Thread getOwningThread() { void setOwningThread(final Thread owningThread) {
return firstStage.getOwningThread(); firstStage.setOwningThread(owningThread);
} }
@Override @Override
......
...@@ -7,7 +7,7 @@ import java.util.Map; ...@@ -7,7 +7,7 @@ import java.util.Map;
import org.junit.Test; import org.junit.Test;
import util.test.StatisticsUtil; import util.test.eval.StatisticsUtil;
public class StopWatchTest { public class StopWatchTest {
......
wiki @ cdfd44ee
Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8 Subproject commit cdfd44ee829e7bba079ee71983e5711a4e6cb259
...@@ -13,6 +13,7 @@ import org.junit.runner.Description; ...@@ -13,6 +13,7 @@ import org.junit.runner.Description;
import teetime.util.StopWatch; import teetime.util.StopWatch;
import teetime.util.TimestampObject; import teetime.util.TimestampObject;
import util.test.eval.StatisticsUtil;
public abstract class PerformanceTest { public abstract class PerformanceTest {
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
</encoder> </encoder>
</appender> </appender>
<logger name="teetime.framework" level="TRACE" /> <!-- <logger name="teetime.framework" level="TRACE" /> -->
<logger name="teetime.stage" level="TRACE" /> <!-- <logger name="teetime.stage" level="TRACE" /> -->
<logger name="teetime" level="INFO" /> <logger name="teetime" level="INFO" />
<logger name="util" level="INFO" /> <logger name="util" level="INFO" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment