sweets from the bootchart2


Please note that this blog has been moved.

Now it has its own domain: mynixworld.infoūüôā

If you want to read the latest version of this article (recommended) please click here and I open the page for you.

Starting with April 2012 a new version of the old bootchart have appeared in Gentoo’s package repository. It is named bootchart2. You can read the bootchart2’s README file to understand why do we have a new bootchart(2) and what are the main introduced features.

I previously had some experience using bootchart so I had also the old version already installed on my system. To make sure you will upgrade this piece of software properly, make sure that you will uninstall the old version then install the new version of software.

One thing that I’ve noticed regarding bootchart2 is the fact that there have been introduced a configuration file (/etc/bootchartd.conf) which allows us to configure few things about how data is collected, logged and then plotted to a chart when the boot process is considered as completed.

The following variables allows us to configure how bootchart2 is working:

  • SAMPLE_HZ
  • BOOTLOG_DEST
  • AUTO_RENDER
  • AUTO_RENDER_FORMAT
  • AUTO_RENDER_DIR
  • CUSTOM_POST_CMD
  • EXIT_PROC

All of them are already configured OK except the EXIT_PROC variable which in my case was defined as “agetty mgetty mingetty”. Maybe this was because I have installed bootchart2 before I uninstalled bootchart (the old version).

Here you can find the current value of EXIT_PROC variable which at the time I wrote this article was:

EXIT_PROC="kdm_greet xterm konsole gnome-terminal metacity mutter gnome-shell compiz ldm icewm-session enlightenment <strong>xfwm4</strong> openbox"

This one is important because the /lib/bootchart/bootchart-collector will collect data in $BOOTLOG_DEST until it finds a process that is contained in the $EXIT_PROC, then it stops, i.e.

if [ -n "$EXIT_PROC" -a -n "$( pidof $EXIT_PROC )" ]; then
# give an unambiguous settle afterwards - so we get
# more post-login data for slow systems
$USLEEP 20000000

# Write / flush the log files
stop
return
fi

Besides these I also have found that a new GUI tool had been given to the user, it is called pybootchartgui:

Usage: pybootchartgui [options] PATH, ..., PATH

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -i, --interactive     start in active mode
  -f FORMAT, --format=FORMAT
                        image format (png, svg, pdf); default format png
  -o PATH, --output=PATH
                        output path (file or directory) where charts are
                        stored
  -n, --no-prune        do not prune the process tree
  -q, --quiet           suppress informational messages
  -t, --boot-time       only display the boot time of the boot in text format
                        (stdout)
  --very-quiet          suppress all messages except errors
  --verbose             print all messages
  --profile             profile rendering of chart (only useful when in batch
                        mode indicated by -f)
  --show-pid            show process ids in the bootchart as 'processname
                        [pid]'
  --show-all            show all process information in the bootchart as
                        '/process/path/exe [pid] [args]'
  --crop-after=PROCESS  crop chart when idle after PROCESS is started
  --annotate=PROCESS    annotate position where PROCESS is started; can be
                        specified multiple times. To create a single
                        annotation when any one of a set of processes is
                        started, use commas to separate the names
  --annotate-file=FILENAME
                        filename to write annotation points to

The –boot-time option can be used when you want only to get the total boot time at the console output:

eugen-gentoo # pybootchartgui -q ‚Äď-boot-time --crop-after=xfwm4
No path given, trying /var/log/bootchart.tgz
00:05.72

Also I’ve found especially useful the –crop-after option that will filter the processes shown into the chart based on the specified <process name> (e.g. xfwm4). More than this, the chart will plot a red vertical dotted line that represents the point in time when your boot process is considered as completed (see my chart).

Another interesting option is –interactive which will show the chart in its own (Python) GUI:

click here to zoom

This GUI has two tabs: one that shows only the kernel boot (k-boot) and one that shows the full tree chart (including the k-boot). In the picture above the print-screen has been taken from the full-tree tab.

I found that we can use this tool not even for measuring the boot process timing but also any kind of process. For instance, I wanted to measure what’s happening during the compilation of thunar source code (emerge thunar) so I could use bootchart2 to measure this:

bootchartd start && emerge thunar && bootchartd stop

This (bootchartd) has collected the system data during the “emerge thunar” process then has created a chart that showed me step by step what was happening during the compilation and how much took each subprocess:

click here to zoom

I am not saying that I have shown a good example of usage but anyway, I only wanted to prove that this piece of tool can be used even for other things than measuring the boot time.

Thank you Michael Meeks for this pleasant surprise.

About Eugen Mihailescu

Always looking to learn more about *nix world, about the fundamental concepts of arithmetic, algebra and geometry. I am also passionate about programming, database and systems administration.
This entry was posted in linux and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s