From ArchWiki
Revision as of 14:32, 8 February 2009 by Peterix (talk | contribs) (Initial bootchart page - how to install & use)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Bootchart is a handy tool used for profiling the Linux boot sequence, generally used for making your computer boot faster. It consists of the bootchartd daemon and bootchart-render, which is used to generate the resulting chart.

Installing Bootchart

Bootchart can be easily installed by:

# pacman -Sy bootchart

Running Bootchart

To make use of bootchart, you have to either set it as the init process in your boot loader or starting it manually from one of the init scripts (rc.sysinit preferrably). Note that if you start bootchartd manually, you have to stop it manually too. In general, be extra careful with this step.

Boot loader setup

This generally involves making a copy of the boot option you want to profile and adding 'init=/sbin/bootchartd' to it. When started from the boot loader, bootchart will stop when you get to the login prompt.





Grub 2

Open up /boot/grub/grub.cfg, copy the boot option you want to profile and edit it ot look like this:

# (0) Arch Linux
menuentry "Arch Linux" {
set root=(hd0,1)
linux /boot/vmlinuz26 root=/dev/sda1 ro
initrd /boot/kernel26.img
# (1) Arch Linux with Bootchart
menuentry "Arch Linux with Bootchart" {
set root=(hd0,1)
linux /boot/vmlinuz26 root=/dev/sda1 ro init=/sbin/bootchartd
initrd /boot/kernel26.img

Now you can reboot and choose the new bootcharting option.

rc.sysinit setup

This one is dangerous (you can make your Arch Linux unbootable) - use it only when the first approach fails. When run in this way, not only you'll have to stop bootchartd manually after you boot up (or it will completely fill your harddrive) but it will start with every boot too. Also, any changes to /etc/rc.sysinit will be reverted next time you update the initscripts package. On the positive side, you'll end up with a bootchart that shows what happens after you log in.

Edit /etc/rc.sysinit

Now, we're going to add this line:

/sbin/bootchartd start

to /etc/rc.sysinit

It can't be too high up, because that would render the system unbootable, but placing it too far into the script will hide anything that happened before from the bootchart. It should be safe to put this right before the section that brings up the system clock. Look for this line:

stat_busy "Configuring System Clock"

Put this:

/sbin/bootchartd start

before it.

Stop bootchartd after login

As stated previouslt, you have to stop bootchartd manually. Either run this as root:

/sbin/bootchartd stop

Or with sudo if you have that set up:

sudo /sbin/bootchartd stop

Generating a chart

Generating a bootchart involves running:


in a folder to which you have write access. This will generate a 'bootchart.png' image with your chart. You'll have to have a Java runtime installed and properly set up before you can do this.

Example bootcharts