Fixes + adapts statistics and CSV modules

This commit is contained in:
Maximilian Kratz 2022-04-12 16:24:45 +02:00
parent a9dc7eafe8
commit 491567bc8c
3 changed files with 30 additions and 14 deletions

View file

@ -19,7 +19,7 @@ public class Runner {
/**
* Number of experiments (= runs).
*/
private static final int NUM_OF_EXPS = 3;
private static final int NUM_OF_EXPS = 5;
/**
* Private constructor ensures no object instantiation.
@ -55,13 +55,13 @@ public class Runner {
final String outputName = expName + "_stats.csv";
// Currently, the number of metrics is hard-coded against CsvUtil.java
double[] outputMean = new double[22];
double[] outputStdDev = new double[22];
double[] outputMean = new double[20];
double[] outputStdDev = new double[20];
// Iterate over all lines of the files
for (int v = 0; v < data.get(0).size(); v++) {
// Iterate over all metrics
for (int i = 0; i < 22; i++) {
for (int i = 0; i < 20; i++) {
final Double[] values = new Double[data.size()];
// Iterate over the data sets (= files)
@ -93,11 +93,11 @@ public class Runner {
//
final Map<String, Double[]> timeSums = new HashMap<>();
timeSums.put("time_total", new Double[3]);
timeSums.put("time_pm", new Double[3]);
timeSums.put("time_ilp", new Double[3]);
timeSums.put("time_deploy", new Double[3]);
timeSums.put("time_rest", new Double[3]);
timeSums.put("time_total", new Double[NUM_OF_EXPS]);
timeSums.put("time_pm", new Double[NUM_OF_EXPS]);
timeSums.put("time_ilp", new Double[NUM_OF_EXPS]);
timeSums.put("time_deploy", new Double[NUM_OF_EXPS]);
timeSums.put("time_rest", new Double[NUM_OF_EXPS]);
for (final String key : timeSums.keySet()) {
for (int i = 0; i < timeSums.get(key).length; i++) {

View file

@ -1,13 +1,21 @@
package statistics;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
/**
* Configuration of the statistic module.
*
* @author Maximilian Kratz {@literal <maximilian.kratz@es.tu-darmstadt.de>}
*/
public interface StatisticConfig {
public class StatisticConfig {
/**
* Private constructor ensures no instantiation.
*/
private StatisticConfig() {
}
/**
* If true, the names of the virtual networks will start at 1 instead of 0 for
@ -23,7 +31,8 @@ public interface StatisticConfig {
/**
* Rounding decimal format setting for the time sums.
*/
public static final DecimalFormat ROUND_TIMESUMS_FORMAT = new DecimalFormat("0.00");
public static final DecimalFormat ROUND_TIMESUMS_FORMAT = ((DecimalFormat) NumberFormat
.getNumberInstance(new Locale("en", "US")));
/**
* If true, the time-based total values (time_total, time_total_stddev) of the
@ -42,4 +51,11 @@ public interface StatisticConfig {
*/
public static final DecimalFormat ROUND_TIMETOTALSTDDEV_FORMAT = new DecimalFormat("0.0000");
/*
* Apply pattern to time sums format
*/
static {
ROUND_TIMESUMS_FORMAT.applyPattern("0.00");
}
}

View file

@ -174,14 +174,14 @@ public class CsvUtil {
final CSVParser parser = new CSVParser(new FileReader(csvPath), formatNormal);
final List<CSVRecord> recs = parser.getRecords();
for (int i = 1; i < recs.size(); i++) {
final Double[] val = new Double[22];
final Double[] val = new Double[20];
final CSVRecord rec = recs.get(i);
for (int j = 3; j <= 23; j++) {
for (int j = 3; j <= 21; j++) {
val[j - 3] = Double.valueOf(rec.get(j));
}
// Sum time metrics up
val[21] = val[0] // time_pm
val[19] = val[0] // time_pm
+ val[1] // time_ilp
+ val[2] // time_deploy
+ val[3]; // time_rest