ui: measure ui state time in CPU time (#37983)

* all

* rename
This commit is contained in:
Shane Smiskol
2026-05-08 00:48:43 -07:00
committed by GitHub
parent 32671d1c3f
commit ab1a962803
+8 -5
View File
@@ -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()