diff --git a/config.rc b/config.rc index 9a7859b1eccca833856dcd11e7256febca0f8e21..554570004a0b7a55b95dd022b791bc325cd6ddc8 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 d97c6435fba693f2b26da47ee5f6d8bcbf2f733b..34434e0457f7da615703e52742864513a0b5d9eb 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 4eadda0c1273832f443ccb50eb6f8712b7d2ca27..571174c2edf9b1af296366240283e5966ef8a045 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 3f79088a75eeb9eca797b1862080150a2e828a70..0000000000000000000000000000000000000000 --- 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 44376a1a0468531be74b493140261adcb63b51d4..0000000000000000000000000000000000000000 --- 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 cc70b50120fdcf42c7fbc634100a9e9606ec83a4..024471b4ed3604f608ee460c5b3b82644891ac56 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 123691eb2f33bce87a9f2b56c03f03932a372dfb..68dafd070598ea6dc008362685f07c79e1a282d4 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 } }