ci: more robust memory usage test in test_onroad (#34067)

metric
pull/34070/head
Maxime Desroches 5 months ago committed by GitHub
parent c9a3a1a018
commit b206879e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      selfdrive/test/test_onroad.py

@ -300,13 +300,18 @@ class TestOnroad:
assert cpu_ok
def test_memory_usage(self):
print("\n------------------------------------------------")
print("--------------- Memory Usage -------------------")
print("------------------------------------------------")
offset = int(SERVICE_LIST['deviceState'].frequency * LOG_OFFSET)
mems = [m.deviceState.memoryUsagePercent for m in self.msgs['deviceState'][offset:]]
print("Memory usage: ", mems)
# check for big leaks. note that memory usage is
# expected to go up while the MSGQ buffers fill up
assert max(mems) - min(mems) <= 3.0
assert np.average(mems) <= 65, "Average memory usage above 65%"
assert np.max(np.diff(mems)) <= 4, "Max memory increase too high"
assert np.average(np.diff(mems)) <= 1, "Average memory increase too high"
def test_gpu_usage(self):
assert self.gpu_procs == {"weston", "ui", "camerad", "selfdrive.modeld.modeld", "selfdrive.modeld.dmonitoringmodeld"}

Loading…
Cancel
Save