app.BRunnerApplication Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brunner-basic-app Show documentation
Show all versions of brunner-basic-app Show documentation
Default application for the BRunner project
The newest version!
package app;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cli.BRunnerCLI;
import configuration_file_parser.SupportedFormatsConstants;
import logManager.LogManager;
import radicchio.FileUtils;
/**
* Demo class for BRunner.
*/
public class BRunnerApplication {
static Logger LOG = LoggerFactory.getLogger(BRunnerApplication.class);
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
bench("", args);
}
/**
* @param args
* @throws Exception
*/
public static void bench(String configurationFile, String[] args) throws Exception {
/*
* Prepare log
*/
LogManager.clearLog();
printBRunnerASCIIArt();
System.out.println("Log: " + LogManager.getLogFileName() + "\n");
LogManager.logStart();
/*
* Read inputs
*/
var CLI_input = BRunnerCLI.processInputs(args);
/*
* Set configuration files
*/
ArrayList configFiles = new ArrayList<>();
for (String path : CLI_input.files()) {
configFiles.addAll(FileUtils.getFileNames(path, Set.of(SupportedFormatsConstants.BRUNNER.getName())));
}
Collections.sort(configFiles);
if (CLI_input.files().isEmpty()) {
LOG.debug("a list of filepaths is expected ; using default file {} ");
configFiles.addAll(FileUtils.getFileNames(configurationFile,
Set.of(SupportedFormatsConstants.BRUNNER.getName())));
}
LOG.info(prettyPrintConfigFiles(configFiles));
/*
* Set runner
*/
var runner = CLI_input.runner();
/*
* Run benchmarks !
*/
configFiles.forEach(runner::run);
}
public static String prettyPrintConfigFiles(List files) {
StringBuilder b = new StringBuilder("\n\nBRunner configuration file(s) : ");
int count = 0;
for (String file : files) {
b.append("\n " + (++count) + ") " + file);
}
b.append("\n");
return b.toString();
}
public static void printBRunnerASCIIArt() {
String[] asciiArt = new String[] { "██████ ██████ ██ ██ ███ ██ ███ ██ ███████ ██████ ",
"██ ██ ██ ██ ██ ██ ████ ██ ████ ██ ██ ██ ██ ",
"██████ █████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██████ ",
"██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ",
"██████ ██ ██ ██████ ██ ████ ██ ████ ███████ ██ ██ ",
" ",
" " };
for (String line : asciiArt) {
System.out.println(line);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy