1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-29 22:24:51 +00:00

Changes after review of pull #5

- Use superclass writeToFile - improved to accept generic Map collections
- Change timer results format to one more in line with the rest
This commit is contained in:
muendelezaji
2016-05-05 20:07:51 +01:00
parent f648cbe614
commit cde0b12c5d
11 changed files with 23 additions and 44 deletions

View File

@@ -36,8 +36,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.Arrays;
import java.util.List;
import java.util.LinkedHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
@@ -253,19 +251,18 @@ public class UxPerfUiAutomation extends BaseUiAutomation {
}
}
public void writeResultsToFile(LinkedHashMap timingResults, String file) throws Exception {
public void writeResultsToFile(Map<String, Timer> results, String file) throws Exception {
// Write out the key/value pairs to the instrumentation log file
FileWriter fstream = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fstream);
Iterator<Entry<String, Timer>> it = timingResults.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Timer> pairs = it.next();
Timer results = pairs.getValue();
long start = results.getStart();
long finish = results.getFinish();
long duration = results.getDuration();
out.write(String.format(pairs .getKey() + " " + start + " " + finish + " " + duration + "\n"));
BufferedWriter out = new BufferedWriter(new FileWriter(file));
long start, finish, duration;
Timer timer;
for (Map.Entry<String, Timer> entry : results.entrySet()) {
timer = entry.getValue();
start = timer.getStart();
finish = timer.getFinish();
duration = timer.getDuration();
// Format used to parse out results in workload's update_result function
out.write(String.format("%s %d %d %d\n", entry.getKey(), start, finish, duration));
}
out.close();
}