From e4283729c18ab5c1a42b65f093fd3b4ba007f642 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Mon, 19 Nov 2018 15:12:36 +0000 Subject: workloads/gfxbenchmark: Fix score matching On some devices the score string obtained can contain extra characters. Only use the numerical values from the score when converting, otherwise if not found set the result to 'NaN'. --- wa/workloads/gfxbench/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'wa') diff --git a/wa/workloads/gfxbench/__init__.py b/wa/workloads/gfxbench/__init__.py index b34ece26..d640f558 100755 --- a/wa/workloads/gfxbench/__init__.py +++ b/wa/workloads/gfxbench/__init__.py @@ -29,6 +29,7 @@ class Gfxbench(ApkUiautoWorkload): re.compile(r'1440p Manhattan 3.1 Offscreen score (.+)'), re.compile(r'Tessellation score (.+)'), re.compile(r'Tessellation Offscreen score (.+)')] + score_regex = re.compile(r'.*?([\d.]+).*') description = ''' Execute a subset of graphical performance benchmarks @@ -55,10 +56,13 @@ class Gfxbench(ApkUiautoWorkload): for line in fh: for regex in self.regex_matches: match = regex.search(line) + # Check if we have matched the score string in logcat if match: - try: - result = float(match.group(1)) - except ValueError: + score_match = self.score_regex.search(match.group(1)) + # Check if there is valid number found for the score. + if score_match: + result = float(score_match.group(1)) + else: result = 'NaN' entry = regex.pattern.rsplit(None, 1)[0] context.add_metric(entry, result, 'FPS', lower_is_better=False) -- cgit v1.2.3