Files
agnos-builder/userspace/usr/comma/tests/benchmark_weston.py
T
Adeeb Shihadeh d54e993b51 weston: treat all panels the same (#128)
* weston: treat all panels the same

* fix linter
2023-05-01 19:02:51 -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 770 /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")