From fe4ab754fb40a8de0aea6ed732fa8167abc431fc Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 25 Feb 2023 21:45:06 -0800 Subject: [PATCH] boot time analysis script --- .../usr/comma/tests/analyze-boot-time.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 userspace/usr/comma/tests/analyze-boot-time.py diff --git a/userspace/usr/comma/tests/analyze-boot-time.py b/userspace/usr/comma/tests/analyze-boot-time.py new file mode 100755 index 0000000..fc3123e --- /dev/null +++ b/userspace/usr/comma/tests/analyze-boot-time.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +import subprocess +from tabulate import tabulate + +# serial with timestamps: +# grabserial -d /dev/serial/by-id/usb-FTDI_FT230X* -t + +# systemd-analyze critical-chain weston-ready.service +# systemd-analyze critical-chain comma.service + +if __name__ == "__main__": + ts = { + # these are dumped over serial, use the ones from the XBL + "XBL": 2.4, + "ABL": 3.7, # 3s of this is waiting for fastboot + factory reset tapping + } + + out = subprocess.check_output("systemd-analyze", shell=True, encoding='utf8') + l = out.splitlines()[0].split(' ') + ts['kernel'] = float(l[3][:-1]) + ts['graphical.target'] = float(l[6][:-1]) + + # print + tot = 0 + total = sum(ts.values()) + tab = [] + for s, t in ts.items(): + tot += t + tab.append([ + s, + round(t, 2), + round(tot, 2), + str(round(t/total * 100)) + "%", + ]) + print(tabulate(tab))