1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-01 19:02:31 +01:00

Simplify metric collection

This commit is contained in:
muendelezaji
2016-05-04 09:34:44 +01:00
parent c65878fee4
commit 1396c5404f
3 changed files with 8 additions and 9 deletions

View File

@@ -14,7 +14,6 @@
# #
import os import os
import re
import time import time
from wlauto import AndroidUiAutoBenchmark, Parameter from wlauto import AndroidUiAutoBenchmark, Parameter
@@ -106,14 +105,12 @@ class SkypeEcho(AndroidUiAutoBenchmark):
# process results and add them using # process results and add them using
# context.result.add_metric # context.result.add_metric
with open(results_file, 'r') as lines: with open(results_file, 'r') as lines:
pattern = r'(?P<key>\w+)\s+(?P<value1>\d+)\s+(?P<value2>\d+)\s+(?P<value3>\d+)'
regex = re.compile(pattern)
for line in lines: for line in lines:
match = regex.search(line) if line.startswith('timer:'):
if match: res = line.split(' ')
context.result.add_metric((match.group('key') + "_start"), match.group('value1')) context.result.add_metric(res[1] + '_start', res[2])
context.result.add_metric((match.group('key') + "_finish"), match.group('value2')) context.result.add_metric(res[1] + '_finish', res[3])
context.result.add_metric((match.group('key') + "_duration"), match.group('value3')) context.result.add_metric(res[1] + '_duration', res[4])
def teardown(self, context): def teardown(self, context):
self.logger.info('===== teardown() ======') self.logger.info('===== teardown() ======')

View File

@@ -73,7 +73,8 @@ public class UiAutomation extends UxPerfUiAutomation {
start = timer.getStart(); start = timer.getStart();
finish = timer.getFinish(); finish = timer.getFinish();
duration = timer.getDuration(); duration = timer.getDuration();
out.write(entry.getKey() + " " + start + " " + finish + " " + duration + "\n"); // 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(); out.close();
} }
@@ -109,6 +110,7 @@ public class UiAutomation extends UxPerfUiAutomation {
// TODO Needs to be run on UI thread after sleep // TODO Needs to be run on UI thread after sleep
public void endCall() { public void endCall() {
final UiObject endButton = getUiObjectByResourceId(endCallButtonResourceId, "android.widget.ImageView"); final UiObject endButton = getUiObjectByResourceId(endCallButtonResourceId, "android.widget.ImageView");
final UiObject endButton = getUiObjectByResourceId(endCallButtonResourceId, "com.skype.android.widget.SymbolView");
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override @Override
public void run() { public void run() {