|
|
@ -5,6 +5,7 @@ from collections import defaultdict |
|
|
|
|
|
|
|
|
|
|
|
import matplotlib.pyplot as plt |
|
|
|
import matplotlib.pyplot as plt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from cereal.services import SERVICE_LIST |
|
|
|
from openpilot.tools.lib.logreader import LogReader |
|
|
|
from openpilot.tools.lib.logreader import LogReader |
|
|
|
from tqdm import tqdm |
|
|
|
from tqdm import tqdm |
|
|
|
|
|
|
|
|
|
|
@ -48,9 +49,29 @@ def make_pie(msgs, typ): |
|
|
|
if __name__ == "__main__": |
|
|
|
if __name__ == "__main__": |
|
|
|
parser = argparse.ArgumentParser(description='View log size breakdown by message type') |
|
|
|
parser = argparse.ArgumentParser(description='View log size breakdown by message type') |
|
|
|
parser.add_argument('route', help='route to use') |
|
|
|
parser.add_argument('route', help='route to use') |
|
|
|
|
|
|
|
parser.add_argument('--as-qlog', action='store_true', help='decimate rlog using latest decimation factors') |
|
|
|
args = parser.parse_args() |
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
|
|
|
msgs = list(LogReader(args.route)) |
|
|
|
msgs = list(LogReader(args.route)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if args.as_qlog: |
|
|
|
|
|
|
|
new_msgs = [] |
|
|
|
|
|
|
|
msg_cnts: dict[str, int] = defaultdict(int) |
|
|
|
|
|
|
|
for msg in msgs: |
|
|
|
|
|
|
|
msg_which = msg.which() |
|
|
|
|
|
|
|
if msg.which() in ("initData", "sentinel"): |
|
|
|
|
|
|
|
new_msgs.append(msg) |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if msg_which not in SERVICE_LIST: |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
decimation = SERVICE_LIST[msg_which].decimation |
|
|
|
|
|
|
|
if decimation is not None and msg_cnts[msg_which] % decimation == 0: |
|
|
|
|
|
|
|
new_msgs.append(msg) |
|
|
|
|
|
|
|
msg_cnts[msg_which] += 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msgs = new_msgs |
|
|
|
|
|
|
|
|
|
|
|
make_pie(msgs, 'qlog') |
|
|
|
make_pie(msgs, 'qlog') |
|
|
|
plt.show() |
|
|
|
plt.show() |
|
|
|