Bootchart2

From postmarketOS

Use bootchart2 to profile system boot or a running system.

Configure bootchart2

  1. Add the bootchart2 package to your device.
  2. Add the following kernel command line parameters: initcall_debug printk.time=y quiet

Profile system boot

  1. add the following kernel command line parameter: PMOS_BOOTCHART2.
  2. (optional) modify EXIT_PROC in /etc/bootchartd.conf to define when the collector is to stop.
  3. Boot the system.
    • mkinitfs will start /sbin/bootchartd.
    • /sbin/bootchartd will run /sbin/init.
    • Approximately 20 seconds after sshd starts (if using the default value of EXIT_PROC), the collector will exit.
    • /usr/bin/pybootchartgui will create a visualization in /var/log/bootchart.png.

Profile a running system

  1. Use the command /sbin/bootchartd start (as root) to start profiling
  2. Execute the commands or perform the activity that you want to profile.
  3. Use the command /sbin/bootchartd stop (as root) to stop profiling
    • /usr/bin/pybootchartgui will create a visualization in /var/log/bootchart.png.

Example (QEMU)

This example demonstrates how to use bootchart2 with device-qemu-amd64.

  1. Run pmbootstrap init. At the Extra packages prompt, enter bootchart2.
    > pmbootstrap init
    [18:46:26] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
    ...
    [18:46:29] Choose your target device vendor (either an existing one, or a new one for porting).
    [18:46:29] Available vendors (43): amazon, asus, bq, chuwi, fairphone, finepower, google, gp, hisense, htc, huawei, infocus, jolla, leeco, lenovo, lg, medion, meizu, motorola, nextbit, nobby, nokia, oneplus, oppo, ouya, pine64, planet, purism, qemu, raspberry, samsung, semc, sony, surftab, t2m, tablet, teclast, wiko, wileyfox, wingtech, xiaomi, yu, zte
    [18:46:29] Vendor [qemu]:
    [18:46:30] Available codenames (3): aarch64, amd64, vexpress
    [18:46:30] Device codename [amd64]:
    ...
    [18:46:35] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
    [18:46:35] Extra packages [none]: bootchart2
    ...
    [18:46:40] Done!
    >
  2. Run pmbootstrap install.
  3. Start qemu. Use the kernel command line parameters from the deviceinfo file, and add the bootchart2 parameters. For example:
    pmbootstrap qemu --image-size=2G --host-qemu --display=gtk --cmdline 'PMOS_BOOTCHART2 initcall_debug printk.time=y quiet console=tty1 console=ttyS0 PMOS_NO_OUTPUT_REDIRECT PMOS_FORCE_PARTITION_RESIZE'
  4. Wait until bootchart2 has written the image to /var/log/bootchart.png.
    Qemu bootchart2 example boot.png
  5. Copy the file to your host system (scp -P 2222 <qemu username>@localhost:/var/log/bootchart.png .).
    Qemu bootchart2 example.png