From 73266a016c70fa8abdf11719aa006f4263a61633 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 17 Feb 2025 09:18:41 -0800 Subject: [PATCH] test_onroad: always show model exec timings (#34606) Co-authored-by: Comma Device --- selfdrive/test/test_onroad.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/test/test_onroad.py b/selfdrive/test/test_onroad.py index af2b4fc6e7..8526e32a68 100644 --- a/selfdrive/test/test_onroad.py +++ b/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)