Bootchart: boot profiling
February 24th, 2008 edited by TinchoIf you usually read Debaday, you must have noticed the recent lack of articles. We apologise for that, we’re lacking articles and editing manpower. We really need your help to keep the site running!
Article submitted by Stevem. Guess what? We still need you to submit good articles about software you like!
On a recent vacation my laptop boot time (>4 min.) started getting on my nerves. I resolved to enjoy the vacation but fix things on my return. At home a few minutes with Google brought bootchart to my attention.
Boothchart won’t cure lengthy boot times but it will provide details about how the time is spent. Bootchart is actually two packages, bootchart, the profiler daemon to gather resource data from /proc
during boot, and bootchart-view to create an image from the collected data.
bootchartd starts measuring as soon as /proc
is mounted. From /proc
it collects a sizeable amount of data about processes, including (in 2.6 kernels) disk utilization and throughput.
The documentation suggests to use BSD process accounting to exactly reconstruct the process tree. The CONFIG_BSD_PROCESS_ACCT_V3 feature is enabled in stock Debian kernels, so to use this, you just need to install the acct package.
I expected profiling the system boot would be complicated and I was prepared for some serious hacking to measure the process. In fact, it couldn’t be much easier.
The boot profiler is started as an option to the boot/loader kernel command line.
It works with LILO but Grub’s interactive boot makes it very simple:
- Select your image entry from the boot menu
- Type ‘e‘ to edit the entry
- Append ‘init=/sbin/bootchartd‘ to the command line
- Type ‘b‘ and you’ll be booting with bootchart profiling in effect
bootchartd starts itself and then launches /sbin/init
. There’s no indication that logging is in effect, console output appears as usual. Once you login you’ll find all the boot data stored in a compressed tar, /var/log/bootchartd.tgz
.
To view the data run bootchart-view. It defaults to creating a SVG image but EPS and PNG outputs are possible with the --format
option.
Here’s an example of the output:
By default the chart renderer doesn’t display most ***** processes. If you think that level of detail will be helpful, bootchart-view has a --no-prune
option. Be warned, it will create a fairly large image.
Conclusion: I still haven’t significantly decreased my boot time, many before me have tried and failed, but I discovered a clever, easy-to-use profiling tool to diagnose boot problems.
The bootchart-view package has been available .
The bootchart package has been available .
February 24th, 2008 at 10:37 pm
My laptop boots in 45seconds. Your wait time is just too long even for an old laptop.
Once I had a problem with my laptop where it was trying to wake up my wi-fi network with the wrong settings (using the old /etc/network/interfaces files instead of network-manager after I login). Since my wi-fi network is secured, it failed to stabilish the connection after some minutes. There is a bug report open:
https://bugs.launchpad.net/ubuntu/+bug/108152
The bug description also describes a workaround that worked for me. Are you sure you are not having the same problem?
February 25th, 2008 at 2:59 am
Looking that that bootchart I see alot of things that could slow down your boot process. You should perhaps consider removing or atleast disabling un-needed services. I would start with portmap and nfs. What about the ssh server, and apache, do you really need those on a laptop? If not, you should disable them from auto starting.
The boot time for my laptop is around 28-30s without all the nonessential craps bogging it down.
February 25th, 2008 at 4:54 pm
Interesting. In Ubuntu it is enough to apt-get install the bootchart package; after that every reboot will leave an image with the timestamp in the filename in /var/log/bootchart/
I’d have expected Debian to be the same.
What annoys me more is that GNOME login now takes about the same time as booting.
March 2nd, 2008 at 12:23 pm
@Marius: https://www.fooishbar.org/blog//tech/ubuntu/fastBootMiniBoF-2004-12-09-13-45.html