mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-25 15:23:56 +08:00
* move manager in folder
* inital refactor
* call start
* small cleanup
* add comments
* use self.signal()
* order shouldnt matter
* newlines
* add helpers
* newlines
* add process config
* split out build part of manager
* this should fix most tests
* no sensord on pc
* dont start athena
* remove comment
* fix old athena test
* fix inject model
* fix test car models
* should be not none
* fix helpers exitcode
* ignore manage_athenad
* Use time.monotonic()
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* combine init, remove spinner
* move manager test
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 5a3b511306
38 lines
986 B
Python
Executable File
38 lines
986 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import time
|
|
import numpy as np
|
|
|
|
import cereal.messaging as messaging
|
|
from selfdrive.manager.process_config import managed_processes
|
|
|
|
|
|
N = int(os.getenv("N", "5"))
|
|
TIME = int(os.getenv("TIME", "30"))
|
|
|
|
if __name__ == "__main__":
|
|
sock = messaging.sub_sock('modelV2', conflate=False, timeout=1000)
|
|
|
|
execution_times = []
|
|
|
|
for _ in range(N):
|
|
os.environ['LOGPRINT'] = 'debug'
|
|
managed_processes['modeld'].start()
|
|
time.sleep(5)
|
|
|
|
t = []
|
|
start = time.monotonic()
|
|
while time.monotonic() - start < TIME:
|
|
msgs = messaging.drain_sock(sock, wait_for_one=True)
|
|
for m in msgs:
|
|
t.append(m.modelV2.modelExecutionTime)
|
|
|
|
execution_times.append(np.array(t[10:]) * 1000)
|
|
managed_processes['modeld'].stop()
|
|
|
|
print("\n\n")
|
|
print(f"ran modeld {N} times for {TIME}s each")
|
|
for n, t in enumerate(execution_times):
|
|
print(f"\tavg: {sum(t)/len(t):0.2f}ms, min: {min(t):0.2f}ms, max: {max(t):0.2f}ms")
|
|
print("\n\n")
|