1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-21 20:38:57 +00:00

Merge pull request #465 from marcbonnici/FPS_Fix

Fps fix
This commit is contained in:
setrofim 2017-08-17 11:00:02 +01:00 committed by GitHub
commit 2f683e59d2
2 changed files with 46 additions and 30 deletions

View File

@ -158,11 +158,20 @@ class FpsInstrument(Instrument):
def setup(self, context):
workload = context.workload
if hasattr(workload, 'view'):
use_gfxinfo = not self.force_surfaceflinger and (self.device.get_sdk_version() >= 23)
if use_gfxinfo and not hasattr(workload, 'package'):
self.logger.debug('Workload does not contain a package; falling back to SurfaceFlinger...')
use_gfxinfo = False
if not use_gfxinfo and not hasattr(workload, 'view'):
self.logger.debug('Workload does not contain a view; disabling...')
self.is_enabled = False
return
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 not self.force_surfaceflinger and (self.device.get_sdk_version() >= 23):
if use_gfxinfo:
# 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
@ -186,9 +195,6 @@ class FpsInstrument(Instrument):
self.collector = LatencyCollector(self.outfile, self.device, params or '',
self.keep_raw, self.logger, self.dumpsys_period,
runcmd, lstcmd, self.fps_method)
else:
self.logger.debug('Workload does not contain a view; disabling...')
self.is_enabled = False
def start(self, context):
if self.is_enabled:

View File

@ -29,11 +29,13 @@ class ManualWorkloadConfig(object):
duration=None, # Seconds
user_triggered=None,
view=None,
package=None,
enable_logcat=True
):
self.user_triggered = user_triggered if user_triggered is not None else (False if duration else True)
self.duration = duration or (None if self.user_triggered else self.default_duration)
self.view = view
self.package = package
self.enable_logcat = enable_logcat
@ -56,8 +58,16 @@ class ManualWorkload(Workload):
is not specified, and ``False`` otherwise.
"""),
Parameter('view', default='SurfaceView',
description="""Specifies the View of the workload. This enables instruments that require a
View to be specified, such as the ``fps`` instrument."""),
description="""Specifies the View of the workload. This enables instruments that
require a View to be specified, such as the ``fps`` instrument.
This is required for using "SurfaceFlinger" to collect FPS statistics
and is primarily used on devices pre API level 23"""),
Parameter('package',
description="""Specifies the package name of the workload. This enables
instruments that require a Package to be specified, such
as the ``fps`` instrument. This allows for "gfxinfo" to
be used and is the preferred method of collection for FPS
statistics on devices API level 23+"""),
Parameter('enable_logcat', kind=boolean,
description='If ``True``, ``manual`` workload will collect logcat as part of the results.'),
]