diff --git a/README.md b/README.md index 358e0bcfe47fc4d5e0c0b4d3bfeb227e91115136..cb6229ad30932e91099a58a4e7f9c2f20935f1b0 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,3 @@ Current tools: - mop (model operation) merge, diff, diff-tag, subtract, subtract-tag models - mvis (model visualization) visualize and compute metrics for a given architecture model - pp-static-log - - - - - diff --git a/build.gradle b/build.gradle index 7681be74b0c4a5fe341787cbe9819063beb2009e..920e814f5c210094874c1336fd6b8e8d4bd4c33e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,39 +1,53 @@ /* - * This file was generated by the Gradle 'init' task. - * - * This is a general purpose Gradle build. - * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds - */ +* This file was generated by the Gradle 'init' task. +* +* This is a general purpose Gradle build. +* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds +*/ plugins { - id 'java' + id 'java' + id "com.diffplug.spotless" version "5.17.1" } repositories { - jcenter() - mavenCentral() + jcenter() + mavenCentral() +} + +spotless { + format 'misc', { + // define the files to apply `misc` to + target '*.gradle', '*.md', '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithTabs() // or spaces. Takes an integer argument if you don't like 4 + endWithNewline() + } } subprojects { apply plugin: 'java' + apply plugin: 'com.diffplug.spotless' repositories { - jcenter() - mavenLocal() - mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - maven { url "https://oss.sonatype.org/content/repositories/releases/" } + jcenter() + mavenLocal() + mavenCentral() + maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url "https://oss.sonatype.org/content/repositories/releases/" } } - + dependencies { - implementation 'net.kieker-monitoring:kieker:1.16-SNAPSHOT' - implementation 'net.sourceforge.teetime:teetime:3.1-SNAPSHOT' - implementation 'com.beust:jcommander:1.78' - implementation 'ch.qos.logback:logback-classic:1.1.7' - implementation 'org.slf4j:slf4j-api:1.7.30' - implementation 'org.codehaus.groovy:groovy-all:3.0.2' - - // Use JUnit test framework - testImplementation 'junit:junit:4.13' + implementation 'net.kieker-monitoring:kieker:1.16-SNAPSHOT' + implementation 'net.sourceforge.teetime:teetime:3.1-SNAPSHOT' + implementation 'com.beust:jcommander:1.78' + implementation 'ch.qos.logback:logback-classic:1.1.7' + implementation 'org.slf4j:slf4j-api:1.7.30' + implementation 'org.codehaus.groovy:groovy-all:3.0.2' + + // Use JUnit test framework + testImplementation 'junit:junit:4.13' } } diff --git a/settings.gradle b/settings.gradle index 4d199536ac4b72e07f25ccd5ff9c167dea27d3b2..6013c0e28ef203e0b3a3ff1d4d1d0d0dafb3da17 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1,11 @@ /* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html - */ +* This file was generated by the Gradle 'init' task. +* +* The settings file is used to specify which projects to include in your build. +* +* Detailed information about configuring a multi-project build in Gradle can be found +* in the user manual at https://docs.gradle.org/6.5/userguide/multi_project_builds.html +*/ rootProject.name = 'oceandsl-tools' @@ -19,5 +19,3 @@ include 'tools:mop' include 'tools:mvis' include 'tools:cmi' include 'tools:relabel' - - diff --git a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterMain.java b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterMain.java index 1b538199de7822aa6d26076c2952f75ebecf4fea..a92df6283c17a85af911ae1fc5e10c2b3d77a79e 100644 --- a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterMain.java +++ b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterMain.java @@ -1,6 +1,18 @@ -/* - * This Java source file was generated by the Gradle 'init' task. - */ +/*************************************************************************** + * Copyright (C) 2021 OceanDSL (https://oceandsl.uni-kiel.de) + * + * 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 org.oceandsl.log.rewriter; import java.io.File; @@ -12,57 +24,66 @@ import kieker.common.configuration.Configuration; import kieker.common.exception.ConfigurationException; import kieker.tools.common.AbstractService; -public class LogRewriterMain extends AbstractService<TeetimeConfiguration,LogRewriterSettings>{ - - public static void main(String[] args) { - java.lang.System.exit(new LogRewriterMain().run("Kieker Log ELF Rewriter", - "log-rewriter", args, new LogRewriterSettings())); +/** + * Main class for the operation and class name rewriter used for logs of ELF binaries. + * + * @author Reiner Jung + * @since 1.0 + */ +public class LogRewriterMain extends AbstractService<TeetimeConfiguration, Settings> { + + public static void main(final String[] args) { + java.lang.System + .exit(new LogRewriterMain().run("Kieker Log ELF Rewriter", "log-rewriter", args, new Settings())); } - @Override - protected TeetimeConfiguration createTeetimeConfiguration() throws ConfigurationException { - try { - return new TeetimeConfiguration(this.parameterConfiguration); - } catch (IOException e) { - throw new ConfigurationException(e); - } - } + @Override + protected TeetimeConfiguration createTeetimeConfiguration() throws ConfigurationException { + try { + return new TeetimeConfiguration(this.parameterConfiguration); + } catch (final IOException e) { + throw new ConfigurationException(e); + } + } - @Override - protected File getConfigurationFile() { - // we do not use a configuration file - return null; - } + @Override + protected File getConfigurationFile() { + // we do not use a configuration file + return null; + } - @Override - protected boolean checkConfiguration(Configuration configuration, JCommander commander) { - return true; - } + @Override + protected boolean checkConfiguration(final Configuration configuration, final JCommander commander) { + return true; + } + + @Override + protected boolean checkParameters(final JCommander commander) throws ConfigurationException { + if (!this.parameterConfiguration.getAddrlineExecutable().canExecute()) { + this.logger.error("Addr2line file {} is not executable", + this.parameterConfiguration.getAddrlineExecutable()); + return false; + } + if (!this.parameterConfiguration.getModelExecutable().canExecute()) { + this.logger.error("Model file {} is not executable", this.parameterConfiguration.getModelExecutable()); + return false; + } + for (final File inputFile : this.parameterConfiguration.getInputFiles()) { + if (!inputFile.isDirectory()) { + this.logger.error("Input directory {} is not directory", inputFile); + return false; + } + } + if (!this.parameterConfiguration.getOutputFile().isDirectory()) { + this.logger.error("Output directory {} is not directory", this.parameterConfiguration.getOutputFile()); + return false; + } + return true; + } - @Override - protected boolean checkParameters(JCommander commander) throws ConfigurationException { - if (!this.parameterConfiguration.getAddrlineExecutable().canExecute()) { - this.logger.error("Addr2line file {} is not executable", this.parameterConfiguration.getAddrlineExecutable()); - return false; - } - if (!this.parameterConfiguration.getModelExecutable().canExecute()) { - this.logger.error("Model file {} is not executable", this.parameterConfiguration.getModelExecutable()); - return false; - } - if (!this.parameterConfiguration.getInputFile().isDirectory()) { - this.logger.error("Input directory {} is not directory", this.parameterConfiguration.getInputFile()); - return false; - } - if (!this.parameterConfiguration.getOutputFile().isDirectory()) { - this.logger.error("Output directory {} is not directory", this.parameterConfiguration.getOutputFile()); - return false; - } - return true; - } + @Override + protected void shutdownService() { + // TODO Auto-generated method stub - @Override - protected void shutdownService() { - // TODO Auto-generated method stub - - } + } } diff --git a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterSettings.java b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterSettings.java deleted file mode 100644 index c425cc0578dee1e0857a5d7e8e0276304e68294e..0000000000000000000000000000000000000000 --- a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/LogRewriterSettings.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - */ -package org.oceandsl.log.rewriter; - -import java.io.File; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.converters.FileConverter; - -/** - * @author reiner - * - */ -public class LogRewriterSettings { - - @Parameter(names = { "-i", "--input" }, required = true, converter = FileConverter.class, description = "Input Kieker log directory") - private File inputFile; - - @Parameter(names = { "-o", "--output" }, required = true, converter = FileConverter.class, description = "Output directory where to put the Kieker log directory") - private File outputFile; - - @Parameter(names = { "-a", "--addrline" }, required = true, converter = FileConverter.class, description = "Location of the addrline tool") - private File addrlineExecutable; - - @Parameter(names = { "-m", "--model" }, required = true, converter = FileConverter.class, description = "Location of the model executable") - private File modelExecutable; - - public File getInputFile() { - return this.inputFile; - } - - public File getOutputFile() { - return this.outputFile; - } - - public File getAddrlineExecutable() { - return this.addrlineExecutable; - } - - public File getModelExecutable() { - return this.modelExecutable; - } -} diff --git a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/RegTestMain.java b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/RegTestMain.java deleted file mode 100644 index 3018a1e271b02e69e507374e0b7633533cead94f..0000000000000000000000000000000000000000 --- a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/RegTestMain.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.oceandsl.log.rewriter; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class RegTestMain { - - public static void main(String[] args) { - String string = "MAIN_ at ??:?"; - final Pattern pattern = Pattern.compile("^(\\w+) at ([\\w\\?]+):([\\d\\?]*)$"); - Matcher matcher = pattern.matcher(string); - - boolean result = matcher.find(); - - System.out.println(matcher.groupCount()); - System.out.println(result); - System.out.println(matcher.group(0)); - System.out.println(matcher.group(1)); - System.out.println(matcher.group(2)); - System.out.println(matcher.group(3)); - } - -} diff --git a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/Settings.java b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/Settings.java new file mode 100644 index 0000000000000000000000000000000000000000..cf6f0da74644c35b9b325450c458dfd8901b0043 --- /dev/null +++ b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/Settings.java @@ -0,0 +1,61 @@ +/*************************************************************************** + * Copyright (C) 2021 OceanDSL (https://oceandsl.uni-kiel.de) + * + * 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 org.oceandsl.log.rewriter; + +import java.io.File; +import java.util.List; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.converters.FileConverter; + +/** + * @author Reiner Jung + * @since 1.0 + */ +public class Settings { + + @Parameter(names = { "-i", + "--input" }, required = true, variableArity = true, converter = FileConverter.class, description = "Input Kieker log directories") + private List<File> inputFiles; + + @Parameter(names = { "-o", + "--output" }, required = true, converter = FileConverter.class, description = "Output directory where to put the Kieker log directory") + private File outputFile; + + @Parameter(names = { "-a", + "--addrline" }, required = true, converter = FileConverter.class, description = "Location of the addrline tool") + private File addrlineExecutable; + + @Parameter(names = { "-m", + "--model" }, required = true, converter = FileConverter.class, description = "Location of the model executable") + private File modelExecutable; + + public List<File> getInputFiles() { + return this.inputFiles; + } + + public File getOutputFile() { + return this.outputFile; + } + + public File getAddrlineExecutable() { + return this.addrlineExecutable; + } + + public File getModelExecutable() { + return this.modelExecutable; + } +} diff --git a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/TeetimeConfiguration.java b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/TeetimeConfiguration.java index 79a37ea2b3cd54f5469ac10b177207bdb323028a..8d0dc5774c22949e29730d2ba5b70ac7c76c894e 100644 --- a/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/TeetimeConfiguration.java +++ b/tools/rewrite-log-entries/src/main/java/org/oceandsl/log/rewriter/TeetimeConfiguration.java @@ -1,6 +1,18 @@ -/** +/*************************************************************************** + * Copyright (C) 2021 OceanDSL (https://oceandsl.uni-kiel.de) * - */ + * 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 org.oceandsl.log.rewriter; import java.io.IOException; @@ -12,16 +24,26 @@ import kieker.tools.source.LogsReaderCompositeStage; import teetime.framework.Configuration; /** - * @author reiner - * + * @author Reiner Jung + * @since 1.0 */ public class TeetimeConfiguration extends Configuration { - public TeetimeConfiguration(final LogRewriterSettings parameterConfiguration) throws IOException { + public TeetimeConfiguration(final Settings parameterConfiguration) throws IOException { + final LogsReaderCompositeStage reader = new LogsReaderCompositeStage(parameterConfiguration.getInputFiles(), + false, 8192); + final RewriteBeforeAndAfterEventsStage processor = new RewriteBeforeAndAfterEventsStage( + parameterConfiguration.getAddrlineExecutable(), parameterConfiguration.getModelExecutable(), false); + final DataSinkStage writer = new DataSinkStage(this.createConfiguration(parameterConfiguration)); + + this.connectPorts(reader.getOutputPort(), processor.getInputPort()); + this.connectPorts(processor.getOutputPort(), writer.getInputPort()); + } + private kieker.common.configuration.Configuration createConfiguration(final Settings parameterConfiguration) + throws IOException { + // Configuration for the data sink stage final kieker.common.configuration.Configuration configuration = new kieker.common.configuration.Configuration(); - configuration.setProperty(LogsReaderCompositeStage.LOG_DIRECTORIES, - parameterConfiguration.getInputFile().getCanonicalPath()); configuration.setProperty("kieker.monitoring.name", "KIEKER"); configuration.setProperty("kieker.monitoring.enabled", "true"); configuration.setProperty("kieker.monitoring.initialExperimentId", "transcoded"); @@ -60,14 +82,6 @@ public class TeetimeConfiguration extends Configuration { configuration.setProperty("kieker.monitoring.writer.filesystem.BinaryFileWriter.compression", kieker.monitoring.writer.compression.NoneCompressionFilter.class.getCanonicalName()); - final LogsReaderCompositeStage reader = new LogsReaderCompositeStage(configuration); - - final RewriteBeforeAndAfterEventsStage processor = new RewriteBeforeAndAfterEventsStage( - parameterConfiguration.getAddrlineExecutable(), parameterConfiguration.getModelExecutable(), false); - - final DataSinkStage writer = new DataSinkStage(configuration); - - this.connectPorts(reader.getOutputPort(), processor.getInputPort()); - this.connectPorts(processor.getOutputPort(), writer.getInputPort()); + return configuration; } }