diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-01-02 16:42:11 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-01-03 10:46:42 +0200 |
commit | a05c9146d46a25f95856b43c5d87620bbf19da1d (patch) | |
tree | 7684b7fdfa9fa7e5d2b879aa3c19cd8ccafcfb97 /py | |
parent | d66d3d3f2f82636002a13a7fd4a33b241c41e6bd (diff) |
py: db.py: Print frame rate at 5s intervals
Print both the number of vsyncs (as reported by the driver in flip
events) and the number of flip events. This is useful to debug frame
rate related issues.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'py')
-rwxr-xr-x | py/tests/db.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/py/tests/db.py b/py/tests/db.py index 20f4236..f0a962d 100755 --- a/py/tests/db.py +++ b/py/tests/db.py @@ -14,8 +14,26 @@ class FlipHandler(pykms.PageFlipHandlerBase): self.front_buf = 0 self.fb1 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); self.fb2 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); + self.flips = 0 + self.frames = 0 + self.time = 0 def handle_page_flip(self, frame, time): + self.flips += 1 + if self.time == 0: + self.frames = frame + self.time = time + + time_delta = time - self.time + if time_delta >= 5: + frame_delta = frame - self.frames + print("Frame rate: %f (%u/%u frames in %f s)" % + (frame_delta / time_delta, self.flips, frame_delta, time_delta)) + + self.flips = 0 + self.frames = frame + self.time = time + if self.front_buf == 0: fb = self.fb2 else: |