From ab1a962803d151cb2f7690c1b06e4ef9fe506f21 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 8 May 2026 00:48:43 -0700 Subject: [PATCH] ui: measure ui state time in CPU time (#37983) * all * rename --- selfdrive/ui/ui.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/ui.py b/selfdrive/ui/ui.py index c571177855..3d3536855b 100755 --- a/selfdrive/ui/ui.py +++ b/selfdrive/ui/ui.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import os +import time from cereal import messaging from openpilot.system.hardware import TICI @@ -24,14 +25,10 @@ def main(): pm = messaging.PubMaster(['uiDebug']) for should_render, frame_time, cpu_time in gui_app.render(): + extra_start = time.monotonic() ui_state.update() if should_render: - msg = messaging.new_message('uiDebug') - msg.uiDebug.cpuTimeMillis = cpu_time * 1000 - msg.uiDebug.frameTimeMillis = frame_time * 1000 - pm.send('uiDebug', msg) - # reaffine after power save offlines our core if TICI and os.sched_getaffinity(0) != cores: try: @@ -39,6 +36,12 @@ def main(): except OSError: pass + extra_cpu = time.monotonic() - extra_start + msg = messaging.new_message('uiDebug') + msg.uiDebug.cpuTimeMillis = (cpu_time + extra_cpu) * 1000 + msg.uiDebug.frameTimeMillis = frame_time * 1000 + pm.send('uiDebug', msg) + if __name__ == "__main__": main()