From 70b265dd34399d89140cacf7dd3d7bdd72030554 Mon Sep 17 00:00:00 2001 From: Michael McGeagh Date: Fri, 24 Feb 2017 16:03:06 +0000 Subject: [PATCH] fps: Added parameter to override FPS collection method In Android M and above, there is a new method of collecting fps statistics, using gfxinfo rather than SurfaceFlinger, but the SF method is still available however. This parameter lets the user decide whether to always use SF, or to allow the instrument to pick the best method based on Android version it detects. --- wlauto/instrumentation/fps/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wlauto/instrumentation/fps/__init__.py b/wlauto/instrumentation/fps/__init__.py index 9cadeebd..e7f3aeaf 100755 --- a/wlauto/instrumentation/fps/__init__.py +++ b/wlauto/instrumentation/fps/__init__.py @@ -132,6 +132,12 @@ class FpsInstrument(Instrument): android/services/surfaceflinger/FrameTracker.h (as of the time of writing currently 128) and a frame rate of 60 fps that is applicable to most devices. """), + Parameter('force_surfaceflinger', kind=boolean, default=False, + description=""" + By default, the method to capture fps data is based on Android version. + If this is set to true, force the instrument to use the SurfaceFlinger method + regardless of its Android version. + """), ] def __init__(self, device, **kwargs): @@ -156,7 +162,7 @@ class FpsInstrument(Instrument): self.fps_outfile = os.path.join(context.output_directory, 'fps.csv') self.outfile = os.path.join(context.output_directory, 'frames.csv') # Android M brings a new method of collecting FPS data - if self.device.get_sdk_version() >= 23: + if not self.force_surfaceflinger and (self.device.get_sdk_version() >= 23): # gfxinfo takes in the package name rather than a single view/activity # so there is no 'list_command' to run and compare against a list of # views/activities. Additionally, clearing the stats requires the package