test_onroad: always show model exec timings (#34606)

Co-authored-by: Comma Device <device@comma.ai>
pull/34607/head
Adeeb Shihadeh 2 months ago committed by GitHub
parent ca05c25ba2
commit 73266a016c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      selfdrive/test/test_onroad.py

@ -348,7 +348,7 @@ class TestOnroad:
result += "------------------------------------------------\n"
print(result)
def test_model_execution_timings(self):
def test_model_execution_timings(self, subtests):
result = "\n"
result += "------------------------------------------------\n"
result += "----------------- Model Timing -----------------\n"
@ -361,11 +361,12 @@ class TestOnroad:
ts = [getattr(m, s).modelExecutionTime for m in self.msgs[s]]
# TODO some init can happen in first iteration
ts = ts[1:]
assert max(ts) < instant_max, f"high '{s}' execution time: {max(ts)}"
assert np.mean(ts) < avg_max, f"high avg '{s}' execution time: {np.mean(ts)}"
result += f"'{s}' execution time: min {min(ts):.5f}s\n"
result += f"'{s}' execution time: max {max(ts):.5f}s\n"
result += f"'{s}' execution time: mean {np.mean(ts):.5f}s\n"
with subtests.test(s):
assert max(ts) < instant_max, f"high '{s}' execution time: {max(ts)}"
assert np.mean(ts) < avg_max, f"high avg '{s}' execution time: {np.mean(ts)}"
result += "------------------------------------------------\n"
print(result)

Loading…
Cancel
Save