mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-14 14:48:53 +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:
parent
f648cbe614
commit
cde0b12c5d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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();
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#
|
||||
|
||||
import os.path as op
|
||||
import re
|
||||
import time
|
||||
|
||||
from wlauto import AndroidUiAutoBenchmark, Parameter
|
||||
@ -109,13 +110,14 @@ class Skype(AndroidUiAutoBenchmark):
|
||||
|
||||
# process results and add them using
|
||||
# context.result.add_metric
|
||||
with open(results_file, 'r') as lines:
|
||||
for line in lines:
|
||||
if line.startswith('timer:'):
|
||||
res = line.split(' ')
|
||||
context.result.add_metric(res[1] + '_start', res[2])
|
||||
context.result.add_metric(res[1] + '_finish', res[3])
|
||||
context.result.add_metric(res[1] + '_duration', res[4])
|
||||
with open(results_file, 'r') as wfh:
|
||||
regex = re.compile(r'(\w+)\s+(\d+)\s+(\d+)\s+(\d+)')
|
||||
for line in wfh:
|
||||
match = regex.search(line)
|
||||
if match:
|
||||
context.result.add_metric((match.group(1) + "_start"), match.group(2))
|
||||
context.result.add_metric((match.group(1) + "_finish"), match.group(3))
|
||||
context.result.add_metric((match.group(1) + "_duration"), match.group(4))
|
||||
|
||||
def teardown(self, context):
|
||||
self.logger.info('===== teardown() ======')
|
||||
|
Binary file not shown.
@ -1,11 +1,8 @@
|
||||
package com.arm.wlauto.uiauto.skype;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
@ -30,8 +27,6 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
public static final String PACKAGE_ID = "com.skype.raider:id/";
|
||||
public static final String TEXT_VIEW = "android.widget.TextView";
|
||||
|
||||
public static String noContactMessage = "Could not find contact \"%s\" in the contacts list.";
|
||||
|
||||
private Map<String, Timer> results = new TreeMap<String, Timer>();
|
||||
private boolean dumpsysEnabled;
|
||||
private String outputDir;
|
||||
@ -62,22 +57,7 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
}
|
||||
|
||||
// Save results
|
||||
saveResults(results, resultsFile);
|
||||
}
|
||||
|
||||
private void saveResults(Map<String, Timer> results, String file) throws Exception {
|
||||
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("timer: %s %d %d %d\n", entry.getKey(), start, finish, duration));
|
||||
}
|
||||
out.close();
|
||||
writeResultsToFile(results, resultsFile);
|
||||
}
|
||||
|
||||
private void handleLoginScreen(String username, String password) throws Exception {
|
||||
@ -155,8 +135,8 @@ public class UiAutomation extends UxPerfUiAutomation {
|
||||
sleep(duration);
|
||||
|
||||
if (video && dumpsysEnabled) {
|
||||
exitDumpsysSurfaceFlinger(PACKAGE, viewName, new File(outputDir, dumpsysTag + "_surface_flinger.log"));
|
||||
exitDumpsysGfxInfo(PACKAGE, new File(outputDir, dumpsysTag + "_gfxinfo.log"));
|
||||
exitDumpsysSurfaceFlinger(PACKAGE, viewName, new File(outputDir, dumpsysTag + "_surfFlinger.log"));
|
||||
exitDumpsysGfxInfo(PACKAGE, new File(outputDir, dumpsysTag + "_gfxInfo.log"));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user