2014-07-29

Analyzing boot process by using Bootchart

Bootchart is a tool designed to show a graphical display of the activity of a system during boot. The tool consists of a data collection tool and a graphic generator tool. In A*, the data collection is built into the 'init' initialization program.

To use Bootchart on an Android System, you need to perform the following steps:

- install the bootchart tool on your host machine
- build 'init' with bootchart support
- install 'init' into your system image
- trigger bootchart functionality on system boot
- retrieve the collected data from the system
- generate the graphic from the data
- view the resulting graphic
- interpret the results

These steps will be described in detail in the following sections on N project

Step 1. Install tools on PC

$sudo apt-get install bootchart

$sudo apt-get install pybootchartgui

NOTE: Extract attached file(pybootchartgui.tar.gz) into /usr/share/pyshared/pybootchartgui/ on your linux machine

Step 2. Building 'init' with bootchart support, there are two ways to do this:

2.1. start from a clean build, and set the variable INIT_BOOTCHART=true

$ cd mydroid

$ export INIT_BOOTCHART=true

$ make clean

$ make

2.2. re-compile just 'init', specifying the variable INIT_BOOTCHART=true

$ touch system/core/init/init.c # necessary step to make sure init.c be compiled

$ m INIT_BOOTCHART=true

Then flash img to device and reboot

Step 3. The default method of telling 'init' to collect data is to place a file with a timeout value in /data. The file is named 'bootchart-start', and contains a single value which is the number of seconds to collect data

$ adb shell 'echo 120 > /data/bootchart-start'

When you reboot your device, bootcharting will start when /init is run, and will end after the indicated period. (120 seconds = 2 minutes)

$adb reboot<br /><br /><strong>

Step 4. Retrieving the collected data from the system

$system/core/init/grab-bootchart.sh

bootchart.tgz will be generated at current folder

Step 5. Generating the graphic from the data

$bootchart bootchart.tgz

Then you will get bootchart.png

Below picture shows a bootchart with low CPU usage.

This one is the normal bootchart as you can see CPU usage is bettern than above one.

 

 

No comments: