1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

derived/fps: fix divide by zero

Avoid dividing by frame_count if it's zero when calculating janks_pc.
This commit is contained in:
Sergei Trofimov 2017-11-21 16:51:53 +00:00 committed by marcbonnici
parent c0a896642d
commit 01b0ab8dce

View File

@ -177,11 +177,13 @@ class DerivedSurfaceFlingerStats(DerivedFpsStats):
janks = 0
not_at_vsync = 0
janks_pc = 0 if frame_count == 0 else janks * 100 / frame_count
return [DerivedMetric('fps', fps, 'fps'),
DerivedMetric('total_frames', frame_count, 'frames'),
MeasurementsCsv(csv_file),
DerivedMetric('janks', janks, 'count'),
DerivedMetric('janks_pc', janks * 100 / frame_count, 'percent'),
DerivedMetric('janks_pc', janks_pc, 'percent'),
DerivedMetric('missed_vsync', not_at_vsync, 'count')]
def _process_without_pandas(self, measurements_csv):