Skip to content
Snippets Groups Projects
Commit c889f614 authored by Reiner Jung's avatar Reiner Jung
Browse files

Cleanup for log rewriter.

parent 345cbee0
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,3 @@ Current tools: ...@@ -19,8 +19,3 @@ Current tools:
- mop (model operation) merge, diff, diff-tag, subtract, subtract-tag models - mop (model operation) merge, diff, diff-tag, subtract, subtract-tag models
- mvis (model visualization) visualize and compute metrics for a given architecture model - mvis (model visualization) visualize and compute metrics for a given architecture model
- pp-static-log - pp-static-log
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
plugins { plugins {
id 'java' id 'java'
id "com.diffplug.spotless" version "5.17.1"
} }
repositories { repositories {
...@@ -14,8 +15,21 @@ repositories { ...@@ -14,8 +15,21 @@ repositories {
mavenCentral() 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 { subprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'com.diffplug.spotless'
repositories { repositories {
jcenter() jcenter()
......
...@@ -19,5 +19,3 @@ include 'tools:mop' ...@@ -19,5 +19,3 @@ include 'tools:mop'
include 'tools:mvis' include 'tools:mvis'
include 'tools:cmi' include 'tools:cmi'
include 'tools:relabel' include 'tools:relabel'
/* /***************************************************************************
* 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; package org.oceandsl.log.rewriter;
import java.io.File; import java.io.File;
...@@ -12,18 +24,24 @@ import kieker.common.configuration.Configuration; ...@@ -12,18 +24,24 @@ import kieker.common.configuration.Configuration;
import kieker.common.exception.ConfigurationException; import kieker.common.exception.ConfigurationException;
import kieker.tools.common.AbstractService; import kieker.tools.common.AbstractService;
public class LogRewriterMain extends AbstractService<TeetimeConfiguration,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(String[] args) { public static void main(final String[] args) {
java.lang.System.exit(new LogRewriterMain().run("Kieker Log ELF Rewriter", java.lang.System
"log-rewriter", args, new LogRewriterSettings())); .exit(new LogRewriterMain().run("Kieker Log ELF Rewriter", "log-rewriter", args, new Settings()));
} }
@Override @Override
protected TeetimeConfiguration createTeetimeConfiguration() throws ConfigurationException { protected TeetimeConfiguration createTeetimeConfiguration() throws ConfigurationException {
try { try {
return new TeetimeConfiguration(this.parameterConfiguration); return new TeetimeConfiguration(this.parameterConfiguration);
} catch (IOException e) { } catch (final IOException e) {
throw new ConfigurationException(e); throw new ConfigurationException(e);
} }
} }
...@@ -35,24 +53,27 @@ public class LogRewriterMain extends AbstractService<TeetimeConfiguration,LogRew ...@@ -35,24 +53,27 @@ public class LogRewriterMain extends AbstractService<TeetimeConfiguration,LogRew
} }
@Override @Override
protected boolean checkConfiguration(Configuration configuration, JCommander commander) { protected boolean checkConfiguration(final Configuration configuration, final JCommander commander) {
return true; return true;
} }
@Override @Override
protected boolean checkParameters(JCommander commander) throws ConfigurationException { protected boolean checkParameters(final JCommander commander) throws ConfigurationException {
if (!this.parameterConfiguration.getAddrlineExecutable().canExecute()) { if (!this.parameterConfiguration.getAddrlineExecutable().canExecute()) {
this.logger.error("Addr2line file {} is not executable", this.parameterConfiguration.getAddrlineExecutable()); this.logger.error("Addr2line file {} is not executable",
this.parameterConfiguration.getAddrlineExecutable());
return false; return false;
} }
if (!this.parameterConfiguration.getModelExecutable().canExecute()) { if (!this.parameterConfiguration.getModelExecutable().canExecute()) {
this.logger.error("Model file {} is not executable", this.parameterConfiguration.getModelExecutable()); this.logger.error("Model file {} is not executable", this.parameterConfiguration.getModelExecutable());
return false; return false;
} }
if (!this.parameterConfiguration.getInputFile().isDirectory()) { for (final File inputFile : this.parameterConfiguration.getInputFiles()) {
this.logger.error("Input directory {} is not directory", this.parameterConfiguration.getInputFile()); if (!inputFile.isDirectory()) {
this.logger.error("Input directory {} is not directory", inputFile);
return false; return false;
} }
}
if (!this.parameterConfiguration.getOutputFile().isDirectory()) { if (!this.parameterConfiguration.getOutputFile().isDirectory()) {
this.logger.error("Output directory {} is not directory", this.parameterConfiguration.getOutputFile()); this.logger.error("Output directory {} is not directory", this.parameterConfiguration.getOutputFile());
return false; return false;
......
/**
*
*/
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;
}
}
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));
}
}
/***************************************************************************
* 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;
}
}
/** /***************************************************************************
* 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; package org.oceandsl.log.rewriter;
import java.io.IOException; import java.io.IOException;
...@@ -12,16 +24,26 @@ import kieker.tools.source.LogsReaderCompositeStage; ...@@ -12,16 +24,26 @@ import kieker.tools.source.LogsReaderCompositeStage;
import teetime.framework.Configuration; import teetime.framework.Configuration;
/** /**
* @author reiner * @author Reiner Jung
* * @since 1.0
*/ */
public class TeetimeConfiguration extends Configuration { 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(); 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.name", "KIEKER");
configuration.setProperty("kieker.monitoring.enabled", "true"); configuration.setProperty("kieker.monitoring.enabled", "true");
configuration.setProperty("kieker.monitoring.initialExperimentId", "transcoded"); configuration.setProperty("kieker.monitoring.initialExperimentId", "transcoded");
...@@ -60,14 +82,6 @@ public class TeetimeConfiguration extends Configuration { ...@@ -60,14 +82,6 @@ public class TeetimeConfiguration extends Configuration {
configuration.setProperty("kieker.monitoring.writer.filesystem.BinaryFileWriter.compression", configuration.setProperty("kieker.monitoring.writer.filesystem.BinaryFileWriter.compression",
kieker.monitoring.writer.compression.NoneCompressionFilter.class.getCanonicalName()); kieker.monitoring.writer.compression.NoneCompressionFilter.class.getCanonicalName());
final LogsReaderCompositeStage reader = new LogsReaderCompositeStage(configuration); return 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());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment