Tuesday, March 1, 2011

Measuring the Boot Process

I was interested in speeding up the boot process on my older laptop, so in keeping with the basics, I sought to measure. After a little searching, I found a tool that looked interesting enough to take for a spin called bootchart that was, conveniently, in Portage:
emerge -s bootchart
[ Results for search key : bootchart ]
[ Applications found : 1 ]

*  app-benchmarks/bootchart
Latest version available: 0.9-r2
Latest version installed: [ Not Installed ]
Size of files: 217 kB
Homepage:      http://www.bootchart.org/
Description:   Performance analysis and visualization of the system boot process
License:       GPL-2
The application provides a script run by the kernel in the init phase that gathers system information in memory, exporting to various image formats on completion of the boot process. I switched to root and installed it.
sudo -s
emerge -av app-benchmarks/bootchart
I kept the default configuration in /etc/bootchartd.conf and added an entry to my grub.conf which included an additional kernel parameter:
mount /boot
vi /boot/grub/grub.conf
title Gentoo Linux 2.6.36-r5 (bootchart)
root (hd0,0)
kernel /boot/kernel-2.6.36-r5 root=/dev/sda3 init=/sbin/bootchartd processor.max_cstate=2 i915.modeset=1
The init kernel parameter allows for a different binary (such as /sbin/bootchartd) to be run instead of /sbin/init as the init process. I had some already-existing kernel parameters defined in my grub.conf to historically handle some Dell-specific noise and X issues; the init parameter was appended to the kernel line with the rest.

After reboot, I selected the grub entry (bootchart) and let the bootchartd script do the rest. When the boot process was done, a collection of logs in a tgz archive and a visualization as a png was exported to /var/log as bootchart.tgz and bootchart.png, respectively.

The png produced is quite nice and indicates that the boot process took 20 seconds - not bad. At first glance, there appears to be room for improvement, but I'll leave that adventure for another day.

Author: tokenmathguy
Date: 2011-03-01 02:21:54 PST
HTML generated by org-mode 7.4 in emacs 23