Files
agnos-builder/userspace/usr/comma/tests/benchmark_weston.py
T
Maxime Desroches 9d57291038 Revert "Remove Qt + weston (#502)"
This reverts commit 3762ea1e3f.
2025-10-28 20:46:07 -07:00

48 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import time
import subprocess
def run(cmd):
subprocess.check_call(cmd, shell=True)
def timestamp_cmd(cmd):
cnt = 0
while True:
cnt += 1
print("try ", cnt)
run("sudo chmod -R 700 /var/tmp/weston/")
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
t = time.monotonic()
time.sleep(0.5)
r = proc.poll()
if r is not None:
continue
break
print("r", r)
return t
if __name__ == "__main__":
run("sudo systemctl stop weston")
run("sudo rm -rf /var/tmp/weston/wayland-0")
time.sleep(0.5)
#run("sudo systemctl restart weston-ready")
run("sudo systemctl restart weston --no-block")
st = time.monotonic()
#ts = defaultdict()
cnt = 0
while not os.path.exists("/var/tmp/weston/wayland-0"):
time.sleep(0.1)
cnt += 1
t = time.monotonic()
print(f"- socket at {t - st:.2f}s")
t = timestamp_cmd('/usr/comma/setup')
print(f"- setup works {t - st:.2f}s")
t = timestamp_cmd('cd /data/openpilot/selfdrive/ui/ && ./spinner')
print(f"- spinner works {t - st:.2f}s")