Skip to content
Snippets Groups Projects
Commit 8845f336 authored by Jan Waller's avatar Jan Waller
Browse files

Clean up, restructure, add Kieker Scripts

parent 89005cea
No related branches found
No related tags found
No related merge requests found
/***************************************************************************
* Copyright 2013 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.tcp;
import java.util.concurrent.TimeUnit;
import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController;
import kieker.analysis.exception.AnalysisConfigurationException;
import kieker.analysis.plugin.filter.flow.EventRecordTraceReconstructionFilter;
import kieker.analysis.plugin.filter.forward.AnalysisThroughputFilter;
import kieker.analysis.plugin.filter.forward.TeeFilter;
import kieker.analysis.plugin.reader.tcp.TCPReader;
import kieker.analysis.plugin.reader.timer.TimeReader;
import kieker.common.configuration.Configuration;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
// Command-Line:
// java -javaagent:lib/kieker-1.8-SNAPSHOT_aspectj.jar -Dkieker.monitoring.writer=kieker.monitoring.writer.tcp.TCPWriter -Dkieker.monitoring.writer.tcp.TCPWriter.QueueFullBehavior=1 -jar dist\OverheadEvaluationMicrobenchmark.jar --recursiondepth 10 --totalthreads 1 --methodtime 0 --output-filename raw.csv --totalcalls 10000000
/**
*
* @author Jan Waller
*
* @since 1.8
*/
public final class TestExperiment2 {
private static final Log LOG = LogFactory.getLog(TestExperiment2.class);
private TestExperiment2() {}
public static void main(final String[] args) throws IllegalStateException, AnalysisConfigurationException {
final IAnalysisController analysisController = new AnalysisController("TCPThroughput");
TestExperiment2.createAndConnectPlugins(analysisController);
try {
analysisController.run();
} catch (final AnalysisConfigurationException ex) {
TestExperiment2.LOG.error("Failed to start the example project.", ex);
}
}
private static void createAndConnectPlugins(final IAnalysisController analysisController) throws IllegalStateException, AnalysisConfigurationException {
final Configuration readerConfig = new Configuration();
// readerConfig.setProperty(TCPReader.CONFIG_PROPERTY_NAME_PORT1, 10333);
// readerConfig.setProperty(TCPReader.CONFIG_PROPERTY_NAME_PORT2, 10334);
final TCPReader reader = new TCPReader(readerConfig, analysisController);
final Configuration timeConfig = new Configuration();
final TimeReader timeReader = new TimeReader(timeConfig, analysisController);
final Configuration configTraceRecon = new Configuration();
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_TIMEUNIT, TimeUnit.SECONDS.name());
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_MAX_TRACE_DURATION, "1");
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_MAX_TRACE_TIMEOUT, "1");
final EventRecordTraceReconstructionFilter traceRecon = new EventRecordTraceReconstructionFilter(configTraceRecon, analysisController);
analysisController.connect(reader, TCPReader.OUTPUT_PORT_NAME_RECORDS, traceRecon, EventRecordTraceReconstructionFilter.INPUT_PORT_NAME_TRACE_RECORDS);
analysisController.connect(timeReader, TimeReader.OUTPUT_PORT_NAME_TIMESTAMPS, traceRecon, EventRecordTraceReconstructionFilter.INPUT_PORT_NAME_TIME_EVENT);
final Configuration counterConfig = new Configuration();
final AnalysisThroughputFilter through = new AnalysisThroughputFilter(counterConfig, analysisController);
analysisController.connect(traceRecon, EventRecordTraceReconstructionFilter.OUTPUT_PORT_NAME_TRACE_VALID, through,
AnalysisThroughputFilter.INPUT_PORT_NAME_OBJECTS);
analysisController.connect(timeReader, TimeReader.OUTPUT_PORT_NAME_TIMESTAMPS, through, AnalysisThroughputFilter.INPUT_PORT_NAME_TIME);
final Configuration confTeeFilter = new Configuration();
confTeeFilter.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_STDOUT);
// confTeeFilter.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_NULL);
final TeeFilter teeFilter = new TeeFilter(confTeeFilter, analysisController);
analysisController.connect(through, AnalysisThroughputFilter.OUTPUT_PORT_NAME_THROUGHPUT, teeFilter, TeeFilter.INPUT_PORT_NAME_EVENTS);
}
}
/***************************************************************************
* Copyright 2013 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.tcp;
import java.util.concurrent.TimeUnit;
import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController;
import kieker.analysis.exception.AnalysisConfigurationException;
import kieker.analysis.plugin.filter.flow.EventRecordTraceReconstructionFilter;
import kieker.analysis.plugin.filter.flow.TraceAggregationFilter;
import kieker.analysis.plugin.filter.forward.TeeFilter;
import kieker.analysis.plugin.reader.tcp.TCPReader;
import kieker.analysis.plugin.reader.timer.TimeReader;
import kieker.common.configuration.Configuration;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
// Command-Line:
// java -javaagent:lib/kieker-1.8-SNAPSHOT_aspectj.jar -Dkieker.monitoring.writer=kieker.monitoring.writer.tcp.TCPWriter -Dkieker.monitoring.writer.tcp.TCPWriter.QueueFullBehavior=1 -jar dist\OverheadEvaluationMicrobenchmark.jar --recursiondepth 10 --totalthreads 1 --methodtime 0 --output-filename raw.csv --totalcalls 10000000
/**
*
* @author Jan Waller
*
* @since 1.8
*/
public final class TestExperiment3 {
private static final Log LOG = LogFactory.getLog(TestExperiment3.class);
private TestExperiment3() {}
public static void main(final String[] args) throws IllegalStateException, AnalysisConfigurationException {
final IAnalysisController analysisController = new AnalysisController("TCPThroughput");
TestExperiment3.createAndConnectPlugins(analysisController);
try {
analysisController.run();
} catch (final AnalysisConfigurationException ex) {
TestExperiment3.LOG.error("Failed to start the example project.", ex);
}
}
private static void createAndConnectPlugins(final IAnalysisController analysisController) throws IllegalStateException, AnalysisConfigurationException {
final Configuration readerConfig = new Configuration();
// readerConfig.setProperty(TCPReader.CONFIG_PROPERTY_NAME_PORT1, 10333);
// readerConfig.setProperty(TCPReader.CONFIG_PROPERTY_NAME_PORT2, 10334);
final TCPReader reader = new TCPReader(readerConfig, analysisController);
final Configuration timeConfig = new Configuration();
final TimeReader timeReader = new TimeReader(timeConfig, analysisController);
final Configuration configTraceRecon = new Configuration();
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_TIMEUNIT, TimeUnit.SECONDS.name());
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_MAX_TRACE_DURATION, "1");
configTraceRecon.setProperty(EventRecordTraceReconstructionFilter.CONFIG_PROPERTY_NAME_MAX_TRACE_TIMEOUT, "1");
final EventRecordTraceReconstructionFilter traceRecon = new EventRecordTraceReconstructionFilter(configTraceRecon, analysisController);
analysisController.connect(reader, TCPReader.OUTPUT_PORT_NAME_RECORDS, traceRecon, EventRecordTraceReconstructionFilter.INPUT_PORT_NAME_TRACE_RECORDS);
analysisController.connect(timeReader, TimeReader.OUTPUT_PORT_NAME_TIMESTAMPS, traceRecon, EventRecordTraceReconstructionFilter.INPUT_PORT_NAME_TIME_EVENT);
final Configuration configTraceAggr = new Configuration();
configTraceAggr.setProperty(TraceAggregationFilter.CONFIG_PROPERTY_NAME_TIMEUNIT, TimeUnit.SECONDS.name());
configTraceAggr.setProperty(TraceAggregationFilter.CONFIG_PROPERTY_NAME_MAX_COLLECTION_DURATION, "1");
final TraceAggregationFilter traceAggr = new TraceAggregationFilter(configTraceAggr, analysisController);
analysisController.connect(traceRecon, EventRecordTraceReconstructionFilter.OUTPUT_PORT_NAME_TRACE_VALID, traceAggr,
TraceAggregationFilter.INPUT_PORT_NAME_TRACES);
analysisController.connect(timeReader, TimeReader.OUTPUT_PORT_NAME_TIMESTAMPS, traceAggr, TraceAggregationFilter.INPUT_PORT_NAME_TIME_EVENT);
final Configuration confTeeFilter = new Configuration();
confTeeFilter.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_STDOUT);
// confTeeFilter.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_NULL);
final TeeFilter teeFilter = new TeeFilter(confTeeFilter, analysisController);
analysisController.connect(traceAggr, TraceAggregationFilter.OUTPUT_PORT_NAME_TRACES, teeFilter, TeeFilter.INPUT_PORT_NAME_EVENTS);
}
}
# Ignore everything in this directory
*
# Except this file
!.gitignore
- long kieker.evaluation.monitoredApplication.MonitoredClass.monitoredMethod(..)
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.evaluation.benchmark; package mooBench.benchmark;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -30,7 +29,7 @@ import org.apache.commons.cli.HelpFormatter; ...@@ -30,7 +29,7 @@ import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import kieker.evaluation.monitoredApplication.MonitoredClass; import mooBench.monitoredApplication.MonitoredClass;
/** /**
* @author Jan Waller * @author Jan Waller
...@@ -46,14 +45,6 @@ public final class Benchmark { ...@@ -46,14 +45,6 @@ public final class Benchmark {
private static int recursionDepth = 0; private static int recursionDepth = 0;
private static boolean quickstart = false; private static boolean quickstart = false;
static {
try {
java.util.logging.LogManager.getLogManager().readConfiguration(Benchmark.class.getClassLoader().getResourceAsStream("META-INF/logging.properties"));
} catch (final IOException ex) {
java.util.logging.Logger.getAnonymousLogger().log(java.util.logging.Level.SEVERE, "Could not load default logging.properties file", ex);
}
}
private Benchmark() {} private Benchmark() {}
public static void main(final String[] args) throws InterruptedException { public static void main(final String[] args) throws InterruptedException {
...@@ -95,7 +86,7 @@ public final class Benchmark { ...@@ -95,7 +86,7 @@ public final class Benchmark {
} }
} }
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
System.out.print(" # 6. Starting benchmark ..."); // NOPMD (System.out) System.out.println(" # 6. Starting benchmark ..."); // NOPMD (System.out)
// 3. Starting Threads // 3. Starting Threads
for (int i = 0; i < Benchmark.totalThreads; i++) { for (int i = 0; i < Benchmark.totalThreads; i++) {
threads[i].start(); threads[i].start();
...@@ -109,7 +100,7 @@ public final class Benchmark { ...@@ -109,7 +100,7 @@ public final class Benchmark {
System.exit(-1); System.exit(-1);
} }
final long totalTime = System.currentTimeMillis() - startTime; final long totalTime = System.currentTimeMillis() - startTime;
System.out.println("done (" + TimeUnit.MILLISECONDS.toSeconds(totalTime) + " s)"); // NOPMD (System.out) System.out.println(" # done (" + TimeUnit.MILLISECONDS.toSeconds(totalTime) + " s)"); // NOPMD (System.out)
// 5. Print experiment statistics // 5. Print experiment statistics
System.out.print(" # 7. Writing results ... "); // NOPMD (System.out) System.out.print(" # 7. Writing results ... "); // NOPMD (System.out)
...@@ -143,6 +134,9 @@ public final class Benchmark { ...@@ -143,6 +134,9 @@ public final class Benchmark {
cmdlOpts.addOption(OptionBuilder.withLongOpt("output-filename").withArgName("filename").hasArg(true).isRequired(true) cmdlOpts.addOption(OptionBuilder.withLongOpt("output-filename").withArgName("filename").hasArg(true).isRequired(true)
.withDescription("Filename of results file. Output is appended if file exists.").withValueSeparator('=').create("o")); .withDescription("Filename of results file. Output is appended if file exists.").withValueSeparator('=').create("o"));
cmdlOpts.addOption(OptionBuilder.withLongOpt("quickstart").isRequired(false).withDescription("Skips initial Garbage Collection.").create("q")); cmdlOpts.addOption(OptionBuilder.withLongOpt("quickstart").isRequired(false).withDescription("Skips initial Garbage Collection.").create("q"));
cmdlOpts.addOption(OptionBuilder.withLongOpt("runnable").withArgName("classname").hasArg(true).isRequired(false)
.withDescription("Class implementing the Runnable interface. run() method is executed before the benchmark starts.").withValueSeparator('=')
.create("r"));
try { try {
CommandLine cmdl = null; CommandLine cmdl = null;
final CommandLineParser cmdlParser = new BasicParser(); final CommandLineParser cmdlParser = new BasicParser();
...@@ -154,9 +148,13 @@ public final class Benchmark { ...@@ -154,9 +148,13 @@ public final class Benchmark {
Benchmark.recursionDepth = Integer.parseInt(cmdl.getOptionValue("recursiondepth")); Benchmark.recursionDepth = Integer.parseInt(cmdl.getOptionValue("recursiondepth"));
Benchmark.quickstart = cmdl.hasOption("quickstart"); Benchmark.quickstart = cmdl.hasOption("quickstart");
Benchmark.ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(Benchmark.outputFn, true), 8192 * 8), false, Benchmark.ENCODING); Benchmark.ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(Benchmark.outputFn, true), 8192 * 8), false, Benchmark.ENCODING);
final String clazzname = cmdl.getOptionValue("runnable");
if (null != clazzname) {
((Runnable) Class.forName(clazzname).newInstance()).run();
}
} catch (final Exception ex) { // NOCS (e.g., IOException, ParseException, NumberFormatException) } catch (final Exception ex) { // NOCS (e.g., IOException, ParseException, NumberFormatException)
new HelpFormatter().printHelp(Benchmark.class.getName(), cmdlOpts); new HelpFormatter().printHelp(Benchmark.class.getName(), cmdlOpts);
ex.printStackTrace(); // NOPMD (Stacktrace) System.out.println(ex.toString()); // NOPMD (Stacktrace)
System.exit(-1); System.exit(-1);
} }
} }
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.evaluation.benchmark; package mooBench.benchmark;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import kieker.evaluation.monitoredApplication.MonitoredClass; import mooBench.monitoredApplication.MonitoredClass;
/** /**
* @author Jan Waller * @author Jan Waller
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
***************************************************************************/ ***************************************************************************/
package kieker.evaluation.monitoredApplication; package mooBench.monitoredApplication;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean; import java.lang.management.ThreadMXBean;
......
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