From df2ae3c4515e51a2029f502c3e2ddeaf8c96cd4d Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Thu, 21 Sep 2017 13:35:11 +0100 Subject: [PATCH] exoplayer: Add metric for dropped frames --- wa/workloads/exoplayer/__init__.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/wa/workloads/exoplayer/__init__.py b/wa/workloads/exoplayer/__init__.py index d475ceff..7eb6a62c 100644 --- a/wa/workloads/exoplayer/__init__.py +++ b/wa/workloads/exoplayer/__init__.py @@ -29,9 +29,10 @@ from devlib.utils.android import grant_app_permissions # Regexps for benchmark synchronization REGEXPS = { - 'start' : '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity', - 'duration' : '.*period \[(?P[0-9]+.*)\]', - 'end' : '.*state \[.+, .+, E\]' + 'start' : '.*Displayed com.google.android.exoplayer2.demo/.PlayerActivity', + 'duration' : '.*period \[(?P[0-9]+.*)\]', + 'end' : '.*state \[.+, .+, E\]', + 'dropped_frames': '.*droppedFrames \[(?P[0-9]+\.[0-9]+), (?P[0-9]+)\]' } @@ -57,6 +58,10 @@ class ExoPlayer(ApkWorkload): loading the ExoPlayer sources into Android Studio. Version r2.4.0 built from commit d979469 is known to work + + Produces a metric 'exoplayer_dropped_frames' - this is the count of frames + that Exoplayer itself reports as dropped. This is not the same thing as the + dropped frames reported by gfxinfo. """ name = 'exoplayer' @@ -182,6 +187,18 @@ class ExoPlayer(ApkWorkload): .format(media_duration_s)) self.monitor.wait_for(REGEXPS['end'], timeout = media_duration_s + 30) + def update_output(self, context): + regex = re.compile(REGEXPS['dropped_frames']) + + dropped_frames = 0 + for line in self.monitor.get_log(): + match = regex.match(line) + if match: + dropped_frames += int(match.group('count')) + + context.add_metric('exoplayer_dropped_frames', dropped_frames, + lower_is_better=True) + def teardown(self, context): super(ExoPlayer, self).teardown(context) self.monitor.stop()