Bootchart

=What it is= Bootchart is a tool for performance analysis and visualization of the GNU/Linux boot process. Resource utilization and process information are collected during the boot process and are later rendered in a PNG, SVG or EPS encoded chart. Its home page is http://www.bootchart.org. Bootchart is distributed under the GNU General Public License v.2.

=Configuration= There is only one config file that you need to be concerned with: /etc/bootchart.conf. This is the default file: # # TMPFS_SIZE=32m BOOTLOG_LOCK=".lock" SAMPLE_PERIOD=10000 PROCESS_ACCOUNTING="yes" BOOTLOG_DEST="/var/log/bootchart.tgz" AUTO_RENDER="no" AUTO_RENDER_FORMAT="svg" AUTO_RENDER_DIR="/var/log"
 * 1) Configuration for bootchartd, the bootchart logger script.
 * 1) tmpfs size
 * 2) (32 MB should suffice for ~20 minutes worth of log data, but YMMV)
 * 1) Lock file
 * 1) Sampling period (in milliseconds)
 * 2) Default 200000 is not fine enough to catch peculiarities in OE-based distro
 * 1) Whether to enable and store BSD process accounting information.  The
 * 2) kernel needs to be configured to enable v3 accounting
 * 3) (CONFIG_BSD_PROCESS_ACCT_V3). accton from the GNU accounting utilities
 * 4) is also required.
 * 1) Tarball for the various boot log files
 * 1) Whether to automatically generate the boot chart once the boot logger
 * 2) completes.  The boot chart will be generated in $AUTO_RENDER_DIR.
 * 3) Note that the bootchart package must be installed.
 * 1) Image format to use for the auto-generated boot chart
 * 2) (choose between png, svg and eps).
 * 1) Output directory for auto-generated boot charts

In order to enable bootchart to run at boot time, you need to run: '/sbin/bootchart_enable'. Before rebooting your phone, you need to make one change in the config file. Change the line that says "AUTO_RENDER" to "yes".

=Getting Data= Here's the catch. The bootchart_enable script copies a special init file in place of the real init file that the kernel starts actually booting the OS itself with. This special init file calls bootchart (among other things). In this special init file is this line:

[ "$AUTO_RENDER" = "yes" -a -x /usr/bin/bootchart ] && \ /usr/bin/bootchart -o "$AUTO_RENDER_DIR" -f $AUTO_RENDER_FORMAT "$BOOTLOG_DEST"
 * 1) Render the chart if configured (and the renderer is installed)

That program (/usr/bin/bootchart) does not exist in webOS, so bootchart cannot autorender the chart for you. In my experimenting however, if the config was NOT set to "autorender", the dump files from bootchart were not created at all. I don't know why this is yet.

To get webOS to creat teh logs needed for a pretty bootchart chart, simply reboot the phone after making the config file change. The boot will be MUCH slower than usual, and it will be slow once the OS is done booting as well. The raw logs will be in "/bootchart".

cp -r /bootchart/ /media/internal/

That will get yourself a copy of the logs.

=Render Chart= Once you have a copy of the logs, disable bootchart for the next boot:

/sbin/bootchart_disable

You may want to reboot your phone now since it will be running VERY slow. As far as I can tell, bootchart is trying in vain to find the renderer and is in a constant state of trying and failing (because the renderer doesn't exist in the webOS distro).

The directory of logs will be 32Meg in size. You may want to "zip" it

cd /media/internal/bootchart tar --remove-files -czvf * bootchart.tgz

You now need to get bootchart.tgz onto a Linux machine that *does* have bootchart installed. On Gentoo, simply "emerge bootchart".

Once on the Linux machine (assuming you put bootchart.tgz - adjust accordingly if you didn't):

cd ~/bootchart bootchart -o ./ -f png bootchart.tgz

You will now have "bootchart.png" in that same directory. You can change the file format (-f) to svg if you want a scalable graphic.

=What It Means= To be honest, webOS's bootchart is a mess. webOS's bootchart:

Here's two bootcharts from my main personal machine (Gentoo). I have disabled and enabled "parallel booting" (starting all boot services in parallel vs. "serial").

You see from the Gentoo charts what a system that has a sense of order should look like. You should also see (plain as day...) why it's important for apps to send the "Done!" signal back to the caller. webOS's init is FULL of "sleep" commands because exit status seems to never be called back to init, so they make everything sleep hoping that the services started. See this comment in /etc/init.d/watchdog.sh:


 * 1) How long should watchdog's timer be?  It takes 8 seconds from when I
 * 2) emit control-alt-delete until the logs stop.  10 or 15 would suffice
 * 3) in that case, and I doubt the user will still have the battery in
 * 4) place if it stays hung for 60 seconds.

So even though it's been timed out, they muse about an additional 2 to 7 seconds to be safe, but they set it to 60:

SLEEP_SECONDS=60

This is just one example of how much more stream lined the boot process can be made to be.

=Conclusion= I don't have much to go on. The webOS bootchart is a mess and I don't know where to start yet. It's a hacked together kludge of shell scripts estimating when system services should be done loading, not getting a call back from them saying that they are done.