Bootchart

Introduction
You probably wonder what is causing your system so long to boot, or how you can improve boot times. Bootchart is the start of your trip. It gives you a nice graph showing stuff like cpu usage, disk usage, IO wait and how/when each part of the bootup process is initiated.

As I myself have spent some time to get bootchart working I hope this article helps other people.

Emerging packages
First lets define some USE flags that you probably want to enable for bootchart.

The java USE flag installs a tool that generates a png or svg file. If you don't enable this you will have to search online for a service where you can generate the image. The acct USE flag enables support for BSD style accounting of processes (which we'll enable later on in the kernel)

Kernel configuration
We need BSD style process accounting compiled into the kernel. This is how you can check it:

If you find CONFIG_BSD_PROCESS_ACCT_V3=y in the output you're done for this part.

Else change your kernel configuration: [ ] General setup [ ] BSD Process Accounting [x] BSD Process Accounting version 3 file format

=sys-apps/baselayout-2.x
If you are using baselayout version 2.x you should change your grub kernel line to get bootchart to work.

This:

Would become this:

So basically init=/sbin/bootchartd is added.

Initrd/initramfs
If you have your own initramfs you should edit it as well (I've updated the initramfs howto article to also include instructions for enabling bootchart).

Edit your /init (relative to your initramfs directory) as follows(replace the exec ... line):

This will automatically detect if you specified a custom init program and execute it instead of /sbin/init.

It is also possible to provide the bootchart init through the real_init argument, like this:

Bootchart configuration
Bootchart is configured in /etc/bootchartd.conf.

There are only 2 or 3 settings that seem reasonable to change(and 1 setting is required to use BSD style process accounting):

Troubleshooting
If you have problems with /var/log/bootchart.tgz not being generated you can do some things to get more information so you can find out what is wrong.

As an example:

Disable the theme and remove the quiet kernel option:

Now when you boot, after the kernel messages, you should notice a message saying "Starting bootchart logging", just before openrc/... is kicking in. When you see this message bootchart is called. Otherwhise it is not.