out.append(sample);
/* followed by all properties */
DetailedExperimentInfo info = e.getResult().get(sample);
for(String prop: allProperties){
out.append(CSV_SEPARATOR);
Measurement m = info.getMeasurements().get(prop);
if (m != null) {
if (m.getValue() instanceof INumericValue) {
/* */
double value = ((INumericValue)m.getValue()).value();
out.append(format.format(value));
} else
out.append(m.getValue().toString());
}
}
out.newLine();
}
/* write header again */
out.append(header);
out.newLine();
/* and write calculated average */
out.append("average");
for (String key : allProperties) {
out.append(CSV_SEPARATOR);
Measurement m = e.getAverages().getMeasurements().get(key);
if (m != null) {
if (m.getValue() instanceof INumericValue) {
double value = ((INumericValue)m.getValue()).value();
out.append(format.format(value));
} else
out.append(m.getValue().toString());
}
}
out.newLine();
out.append("startupTime");
out.append(CSV_SEPARATOR);
try {
out.append(Double.toString(toolExp.getStartupTime()));
} catch (Exception ex) {
log.error("Error in calculating the startup time (linear regression): " + ex.getMessage());
out.append("Err");
}
out.newLine();
out.close();
} catch (IOException e1) {
log.error("Could not write statistics for: " + statistics, e1);
}
}
/*
* and write accumulated values
*/
File statisticsFile = new File(currentResultdir, "accumulated.csv");
allProperties.clear();
allProperties.add(MigrationResult.MIGRES_ELAPSED_TIME_PER_MB);
allProperties.add(MigrationResult.MIGRES_USED_TIME_PER_MB);
allProperties.add(MigrationResult.MIGRES_ELAPSED_TIME);
allProperties.add(MigrationResult.MIGRES_USED_TIME);
//...
try {
BufferedWriter out = new BufferedWriter(new FileWriter(statisticsFile));
/* write machine info */
if (toolExp != null) {
// use machine info of last experiment!
for (String prop: toolExp.getMeasurements().keySet()) {
if (prop.startsWith("machine:")){
out.append(prop)
.append(CSV_SEPARATOR)
.append(toolExp.getMeasurements().get(prop).getList().get(0).getValue().getFormattedValue());
out.newLine();
}
}
out.newLine();
}
/* write header */
out.append("tool");
for (String key : allProperties) {
out.append(CSV_SEPARATOR).append(key);
}
out.newLine();
/* write averaged values for all actions */
for (String action: accumulatedAvg.keySet()){
/* 1. column: action name */
out.append(action);
/* followed by all properties */
DetailedExperimentInfo average = accumulatedAvg.get(action);
for(String prop: allProperties){
out.append(CSV_SEPARATOR);
Measurement m = average.getMeasurements().get(prop);
if (m != null) {
if (m.getValue() instanceof INumericValue) {
/* */
double value = ((INumericValue)m.getValue()).value();
out.append(format.format(value));
} else
out.append(m.getValue().toString());
}
}
out.newLine();
}
out.newLine();