debug: improve count_events.py output

old-commit-hash: 2cf831a3048c11613396a2e6ca2222cefda30935
This commit is contained in:
Adeeb Shihadeh
2024-02-20 14:20:49 -08:00
parent edef8ed522
commit 983b280545

View File

@@ -10,7 +10,6 @@ from cereal.services import SERVICE_LIST
from openpilot.tools.lib.logreader import LogReader, ReadMode
if __name__ == "__main__":
cnt_valid: Counter = Counter()
cnt_events: Counter = Counter()
cams = [s for s in SERVICE_LIST if s.endswith('CameraState')]
@@ -48,17 +47,15 @@ if __name__ == "__main__":
elif msg.which() in cams:
cnt_cameras[msg.which()] += 1
if not msg.valid:
cnt_valid[msg.which()] += 1
duration = (end_time - start_time) / 1e9
print("Events")
pprint(cnt_events)
print("\n")
print("Not valid")
pprint(cnt_valid)
print("Events")
for t, evt in events:
print(f"{t:8.2f} {evt}")
print("\n")
print("Cameras")
@@ -72,11 +69,6 @@ if __name__ == "__main__":
for t, a in alerts:
print(f"{t:8.2f} {a}")
print("\n")
print("Events")
for t, evt in events:
print(f"{t:8.2f} {evt}")
print("\n")
if ignition_off is not None:
ignition_off = round((ignition_off - start_time) / 1e9, 2)