From 2f8b54a31e85601396d9f1b4be5567f30f915793 Mon Sep 17 00:00:00 2001 From: Reiner Jung <reiner.jung@email.uni-kiel.de> Date: Wed, 31 Aug 2022 13:00:21 +0200 Subject: [PATCH] Updated compile results. --- config.rc | 2 +- frameworks/statistics.r | 8 +-- tools/compile-results/build.gradle | 1 + .../tools/results/MakeWindowStage.java | 28 ----------- .../tools/results/ReadCsvFileSource.java | 41 --------------- .../java/moobench/tools/results/Settings.java | 34 ++++++------- .../tools/results/TeetimeConfiguration.java | 50 ++++++++++--------- 7 files changed, 50 insertions(+), 114 deletions(-) delete mode 100644 tools/compile-results/src/main/java/moobench/tools/results/MakeWindowStage.java delete mode 100644 tools/compile-results/src/main/java/moobench/tools/results/ReadCsvFileSource.java diff --git a/config.rc b/config.rc index 9a7859b..5545700 120000 --- a/config.rc +++ b/config.rc @@ -1 +1 @@ -experiment.rc \ No newline at end of file +test.rc \ No newline at end of file diff --git a/frameworks/statistics.r b/frameworks/statistics.r index d97c643..34434e0 100644 --- a/frameworks/statistics.r +++ b/frameworks/statistics.r @@ -90,10 +90,12 @@ print(resultstext) currentTime <- as.numeric(Sys.time()) -write(paste(configs.framework_name, ":"), file=out_yaml_fn,append=FALSE) -write(paste("- timestamp:", currentTime), file=out_yaml_fn, append=TRUE) +write(paste("kind:", configs.framework_name), file=out_yaml_fn,append=FALSE) +write("experiments:", file=out_yaml_fn, append=TRUE) +write(paste("- timestamp:", currentTime), file=out_yaml_fn, append=TRUE) +write(" measurements:", file=out_yaml_fn, append=TRUE) for (writer_idx in (1:(numberOfWriters))) { - write(paste(" ", configs.labels[writer_idx], ": [", + write(paste(" ", configs.labels[writer_idx], ": [", format(printvalues["mean",writer_idx], scientific=TRUE), ",", format(printvalues["sd",writer_idx], scientific=TRUE), ",", format(printvalues["ci95%",writer_idx], scientific=TRUE), ",", diff --git a/tools/compile-results/build.gradle b/tools/compile-results/build.gradle index 4eadda0..571174c 100644 --- a/tools/compile-results/build.gradle +++ b/tools/compile-results/build.gradle @@ -18,4 +18,5 @@ dependencies { implementation 'net.kieker-monitoring:kieker:2.0.0-SNAPSHOT' implementation 'net.sourceforge.teetime:teetime:3.1-SNAPSHOT' implementation 'com.beust:jcommander:1.78' + implementation 'org.yaml:snakeyaml:1.30' } diff --git a/tools/compile-results/src/main/java/moobench/tools/results/MakeWindowStage.java b/tools/compile-results/src/main/java/moobench/tools/results/MakeWindowStage.java deleted file mode 100644 index 3f79088..0000000 --- a/tools/compile-results/src/main/java/moobench/tools/results/MakeWindowStage.java +++ /dev/null @@ -1,28 +0,0 @@ -package moobench.tools.results; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.JsonNode; - -import teetime.stage.basic.AbstractFilter; - -public class MakeWindowStage extends AbstractFilter<List<Map<String, JsonNode>>> { - - private Integer window; - - public MakeWindowStage(Integer window) { - this.window = window; - } - - @Override - protected void execute(List<Map<String, JsonNode>> list) throws Exception { - List<Map<String, JsonNode>> newList = new ArrayList<Map<String, JsonNode>>(); - for (int i=list.size()-window-1;i < list.size();i++) { - newList.add(list.get(i)); - } - this.outputPort.send(newList); - } - -} diff --git a/tools/compile-results/src/main/java/moobench/tools/results/ReadCsvFileSource.java b/tools/compile-results/src/main/java/moobench/tools/results/ReadCsvFileSource.java deleted file mode 100644 index 44376a1..0000000 --- a/tools/compile-results/src/main/java/moobench/tools/results/ReadCsvFileSource.java +++ /dev/null @@ -1,41 +0,0 @@ -package moobench.tools.results; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.DoubleNode; - -import teetime.framework.AbstractConsumerStage; -import teetime.framework.OutputPort; - -public class ReadCsvFileSource extends AbstractConsumerStage<Path> { - - private final OutputPort<Map<String, JsonNode>> outputPort = this.createOutputPort(); - - @Override - protected void execute(Path path) throws Exception { - final CSVParser csvParser = new CSVParser(Files.newBufferedReader(path), - CSVFormat.DEFAULT.withHeader()); - List<String> header = csvParser.getHeaderNames(); - Map<String, JsonNode> recordMap = new HashMap<>(); - CSVRecord record = csvParser.getRecords().get(0); - for (int i=0;i<header.size();i++) { - String value = record.get(header.get(i)); - recordMap.put(header.get(i).trim(), new DoubleNode(Double.parseDouble(value))); - } - csvParser.close(); - this.outputPort.send(recordMap); - } - - public OutputPort<Map<String, JsonNode>> getOutputPort() { - return this.outputPort; - } -} diff --git a/tools/compile-results/src/main/java/moobench/tools/results/Settings.java b/tools/compile-results/src/main/java/moobench/tools/results/Settings.java index cc70b50..024471b 100644 --- a/tools/compile-results/src/main/java/moobench/tools/results/Settings.java +++ b/tools/compile-results/src/main/java/moobench/tools/results/Settings.java @@ -9,35 +9,35 @@ import com.beust.jcommander.converters.PathConverter; public class Settings { - @Parameter(names= { "-l", "--main-log" }, required = true, converter = PathConverter.class, description = "Main log file") - private Path mainLogJson; + @Parameter(names = { "-i", "--input" }, variableArity = true, required = true, converter = PathConverter.class, description = "List of input data sets") + private List<Path> inputPaths; - @Parameter(names= { "-p", "--partial-log" }, required = true, converter = PathConverter.class, description = "Partial log file") - private Path partialLogJson; + @Parameter(names= { "-l", "--log" }, required = true, converter = PathConverter.class, description = "YAML log file root path") + private Path logPath; - @Parameter(names= { "-d", "--result-data" }, variableArity = true, required = true, converter = PathConverter.class, description = "Collection of experiment data") - private List<Path> resultCsvPaths; + @Parameter(names= { "-t", "--table" }, required = true, converter = PathConverter.class, description = "Output HTML table for results") + private Path tablePath; - @Parameter(names= { "-m", "--mapping-file" }, required = true, converter = PathConverter.class, description = "Experiment Result to log mapping") - private Path mappingFile; + @Parameter(names= { "-j", "--json-log" }, required = true, converter = PathConverter.class, description = "Partial JSON log for viewing") + private Path jsonLogPath; @Parameter(names= { "-w", "--window" }, required = true, description = "Time Window Size") private Integer window; - - public Path getMainLogJson() { - return mainLogJson; + + public List<Path> getInputPaths() { + return inputPaths; } - public Path getPartialLogJson() { - return partialLogJson; + public Path getLogPath() { + return logPath; } - public List<Path> getResultCsvPaths() { - return resultCsvPaths; + public Path getTablePath() { + return tablePath; } - public Path getMappingFile() { - return mappingFile; + public Path getJsonLogPath() { + return jsonLogPath; } public Integer getWindow() { diff --git a/tools/compile-results/src/main/java/moobench/tools/results/TeetimeConfiguration.java b/tools/compile-results/src/main/java/moobench/tools/results/TeetimeConfiguration.java index 123691e..68dafd0 100644 --- a/tools/compile-results/src/main/java/moobench/tools/results/TeetimeConfiguration.java +++ b/tools/compile-results/src/main/java/moobench/tools/results/TeetimeConfiguration.java @@ -1,5 +1,7 @@ package moobench.tools.results; +import java.nio.file.Path; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -12,29 +14,29 @@ import teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy; public class TeetimeConfiguration extends Configuration { public TeetimeConfiguration(Settings settings) { - MainLogReader mainLogReader = new MainLogReader(settings.getMainLogJson()); - MappingFileReader mappingFileReader = new MappingFileReader(settings.getMappingFile()); - SpecialArrayElementStage arrayElementStage = new SpecialArrayElementStage(settings.getResultCsvPaths()); - ReadCsvFileSource readCsvFileSource = new ReadCsvFileSource(); - - MergeDataStage mergeDataStage = new MergeDataStage(); - mergeDataStage.declareActive(); - - Distributor<List<Map<String, JsonNode>>> distributor = new Distributor<>(new CopyByReferenceStrategy()); - - LogWriter mainLogWriter = new LogWriter(settings.getMainLogJson()); - MakeWindowStage makeWindowStage = new MakeWindowStage(settings.getWindow()); - LogWriter partialLogWriter = new LogWriter(settings.getPartialLogJson()); - - this.connectPorts(mainLogReader.getOutputPort(), mergeDataStage.getMainLogInputPort()); - this.connectPorts(mappingFileReader.getOutputPort(), mergeDataStage.getMappingInputPort()); - this.connectPorts(arrayElementStage.getOutputPort(), readCsvFileSource.getInputPort()); - this.connectPorts(readCsvFileSource.getOutputPort(), mergeDataStage.getNewDataInputPort()); - - this.connectPorts(mergeDataStage.getOutputPort(), distributor.getInputPort()); - - this.connectPorts(distributor.getNewOutputPort(), mainLogWriter.getInputPort()); - this.connectPorts(distributor.getNewOutputPort(), makeWindowStage.getInputPort()); - this.connectPorts(makeWindowStage.getOutputPort(), partialLogWriter.getInputPort()); + List<Path> logFilePaths = new ArrayList<Path>(); + for (Path path : settings.getInputPaths()) { + logFilePaths.add(settings.getLogPath().resolve(path.getFileName())); + } + + ElementProducer<Path> yamlInputPathsProducer = new ElementProducer<>(settings.getInputPaths()); + ElementProducer<Path> yamlLogPathsProducer = new ElementProducer<>(logFilePaths); + + LogAppender :: logAppender + Distributor :: distributor + + YamlLogSink :: yamlLogSink + ChartAssemblerStage :: chartAssemblerStage + JsonLogSink :: jsonLogSink + GenerateHtmlTable :: generateHtmlTable + FileSink :: fileSink + + yamlInputPathsProducer -> logAppender.newRecord + yamlLogPathsProducer -> logAppender.log + + logAppender.output -- log -> distributor + distributor -> yamlLogSink + distributor -> chartAssemblerStage -> jsonLogSink + distributor -> generateHtmlTable -> fileSink } } -- GitLab