From dcf13f8c2c335a4ebcabee9250d67f7fac456b4a Mon Sep 17 00:00:00 2001 From: Michael McGeagh Date: Mon, 7 Nov 2016 17:39:51 +0000 Subject: [PATCH] FPS - fix regex and handle empty frames --- wlauto/instrumentation/fps/__init__.py | 2 +- wlauto/utils/fps.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wlauto/instrumentation/fps/__init__.py b/wlauto/instrumentation/fps/__init__.py index ea89e6af..54fb353d 100755 --- a/wlauto/instrumentation/fps/__init__.py +++ b/wlauto/instrumentation/fps/__init__.py @@ -277,7 +277,7 @@ class LatencyCollector(threading.Thread): else: self.header = GfxInfoFrame._fields self.process_trace_line = self._process_gfxinfo_line - self.re_frame = re.compile('[0-9,]+') + self.re_frame = re.compile('([0-9]+,)+') self.re_stats = re.compile('.*(percentile|frames|Number).*') # Create a template summary text block that matches what gfxinfo gives after a reset # - 133 is the default ms value for percentiles after reset diff --git a/wlauto/utils/fps.py b/wlauto/utils/fps.py index b25083db..14b7ccad 100755 --- a/wlauto/utils/fps.py +++ b/wlauto/utils/fps.py @@ -108,12 +108,13 @@ class FpsProcessor(object): per_frame_fps.name = 'fps' frame_count = self.data.index.size - janks = frame_time[frame_time >= vsync_interval].count() - not_at_vsync = self.data.IntendedVsync - self.data.Vsync - not_at_vsync = not_at_vsync[not_at_vsync != 0].count() + if frame_count: + janks = frame_time[frame_time >= vsync_interval].count() + not_at_vsync = self.data.IntendedVsync - self.data.Vsync + not_at_vsync = not_at_vsync[not_at_vsync != 0].count() - duration = self.data.Vsync.iloc[-1] - self.data.Vsync.iloc[0] - fps = (1e9 * frame_count) / float(duration) + duration = self.data.Vsync.iloc[-1] - self.data.Vsync.iloc[0] + fps = (1e9 * frame_count) / float(duration) # If gfxinfocsv is provided, get stats from that instead if self.extra_data: