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

added missing kieker performance tests

parent 60904336
No related branches found
No related tags found
No related merge requests found
......@@ -70,26 +70,33 @@ public class WorkerThread extends Thread {
iterations++;
this.iterationStopWatch.start();
// beforeStageExecutionStopWatch.start();
final IStage stage = this.stageScheduler.get();
// beforeStageExecutionStopWatch.end();
this.startStageExecution(stage);
stageExecutionStopWatch.start(); // expensive: takes 1/3 of overall time
final boolean executedSuccessfully = stage.execute();
stageExecutionStopWatch.end();
this.finishStageExecution(stage, executedSuccessfully);
afterStageExecutionStopWatch.start();
// afterStageExecutionStopWatch.start();
if (this.shouldTerminate) {
this.executeTerminationPolicy(stage, executedSuccessfully);
}
this.stageScheduler.determineNextStage(stage, executedSuccessfully);
afterStageExecutionStopWatch.end();
// afterStageExecutionStopWatch.end();
this.iterationStopWatch.end();
// final long schedulingOverhead = this.iterationStopWatch.getDurationInNs() - stageExecutionStopWatch.getDurationInNs();
final long schedulingOverhead = afterStageExecutionStopWatch.getDurationInNs();
final long schedulingOverhead = this.iterationStopWatch.getDurationInNs() - stageExecutionStopWatch.getDurationInNs(); //3198 ms
// final long schedulingOverhead = this.iterationStopWatch.getDurationInNs(); //3656 ms
// final long schedulingOverhead = beforeStageExecutionStopWatch.getDurationInNs(); //417 ms
// final long schedulingOverhead = stageExecutionStopWatch.getDurationInNs(); //503 ms
// final long schedulingOverhead = afterStageExecutionStopWatch.getDurationInNs(); //1214 ms
schedulingOverheadInNs += schedulingOverhead;
if ((iterations % 10000) == 0) {
this.schedulingOverheadsInNs.add(schedulingOverheadInNs);
......
/***************************************************************************
* 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.analysis.examples.throughput;
import java.util.concurrent.Callable;
import kieker.analysis.examples.ThroughputAnalysis;
import kieker.analysis.exception.AnalysisConfigurationException;
import kieker.common.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import teetime.util.StopWatch;
/**
* @author Nils Christian Ehmke
*
* @since 1.10
*/
public class ThroughputAnalysisTest {
private static final int numRuns = 1000;
@Before
public void before() {
System.setProperty(LogFactory.CUSTOM_LOGGER_JVM, "NONE");
}
@Test
public void testWithMultipleRuns() throws IllegalStateException, AnalysisConfigurationException {
final StopWatch stopWatch = new StopWatch();
final long[] durations = new long[numRuns];
for (int i = 0; i < numRuns; i++) {
final ThroughputAnalysis<Object> analysis = new ThroughputAnalysis<Object>();
analysis.setNumNoopFilters(100);
analysis.setInput(100, 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");
}
}
/***************************************************************************
* 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.analysis.examples.throughput;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import kieker.analysis.examples.ThroughputTimestampAnalysis;
import kieker.analysis.exception.AnalysisConfigurationException;
import kieker.common.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import teetime.examples.throughput.TimestampObject;
import teetime.util.StatisticsUtil;
import teetime.util.StopWatch;
/**
* @author Nils Christian Ehmke
*
* @since 1.10
*/
public class ThroughputTimestampAnalysisTest {
private static final int NUM_OBJECTS_TO_CREATE = 100000;
@Before
public void before() {
System.setProperty(LogFactory.CUSTOM_LOGGER_JVM, "NONE");
}
@Test
public void testWithManyObjects() throws IllegalStateException, AnalysisConfigurationException {
final StopWatch stopWatch = new StopWatch();
final List<TimestampObject> timestampObjects = new ArrayList<TimestampObject>(NUM_OBJECTS_TO_CREATE);
final ThroughputTimestampAnalysis analysis = new ThroughputTimestampAnalysis();
analysis.setNumNoopFilters(800);
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.printStatistics(stopWatch.getDurationInNs(), timestampObjects);
}
}
......@@ -48,7 +48,7 @@ public class ThroughputTimestampAnalysisTest {
final ThroughputTimestampAnalysis analysis = new ThroughputTimestampAnalysis();
analysis.setShouldUseQueue(true);
analysis.setNumNoopFilters(10); // 4+n
analysis.setNumNoopFilters(800); // 4+n
analysis.setTimestampObjects(timestampObjects);
analysis.setInput(NUM_OBJECTS_TO_CREATE, new Callable<TimestampObject>() {
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment