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)