1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-30 17:50:46 +00:00

utils.rendering: Fix activity matching

Change the SurfaceFlingerFrameCollector to match activities by prefix
instead of looking for an exact match. This will allow to account for
activities with variable suffixes.
Raise an error if more than one activity matches the provided view.
Show a warning if no activities match the provided view in order to
avoid silently failing.

Suggested-by: Andriani Mappoura <andriani.mappoura@arm.com>
Signed-off-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
This commit is contained in:
Kajetan Puchalski 2023-08-02 16:39:04 +01:00 committed by Marc Bonnici
parent be988bb42b
commit 59ff6100d8

View File

@ -131,9 +131,18 @@ class SurfaceFlingerFrameCollector(FrameCollector):
self.header = header or SurfaceFlingerFrame._fields
def collect_frames(self, wfh):
for activity in self.list():
if activity == self.view:
wfh.write(self.get_latencies(activity).encode('utf-8'))
activities = [a for a in self.list() if a.startswith(self.view)]
if len(activities) > 1:
raise ValueError(
"More than one activity matching view '{}' was found: {}".format(self.view, activities)
)
if not activities:
logger.warning("No activities matching view '{}' were found".format(self.view))
for activity in activities:
wfh.write(self.get_latencies(activity).encode('utf-8'))
def clear(self):
self.target.execute('dumpsys SurfaceFlinger --latency-clear ')