test_onroad: always show model exec timings (#34606)
Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user