Bootchart:android native comes with the boot performance viewing mechanism. By collecting various log data during the Android boot process, the performance of each process in the boot process can be shown graphically. (blog can not be broken ...) ) Compile Bootchart
Bootchart Source is located: \system\core\init\bootchart.c belongs to Init
Check the corresponding android.mk, which has one of these:
ifeq ($(strip $(INIT_BOOTCHART)),true)LOCAL_SRC_FILES += bootchart.cLOCAL_CFLAGS += -DBOOTCHART=1endif
It is obvious that the variable control is compiled, and if you want to compile the Bootchart into INIT, either export this variable to TRUE or define the assignment.
There is a corresponding Bootchart.h header file, which has macro control, want to use Bootchart, how to change it is not more said ~
The native boot is placed in the main of the init.c:
#if BOOTCHART"bootchart_init");#endif
You can see that the first runner should be the Bootchart inside the bootchart_init function.
Can take a look at the source of Bootchart, which has such a sentence:
... int fd = open( LOG_ACCT, O_WRONLY|O_CREAT|O_TRUNC,0644); //这些文件都是/data分区下面的
The first proc_read read is a configuration time:/data/bootchart-start, to determine the time bootchart from open to end.
The second nature is the location of the captured log information:/data/bootchart
Then it is necessary to mount the data partition first, so the place to start Bootchart to be measured!
Using Bootchart
After the normal compilation into the system, you need to manually set the above mentioned configuration:
50> /data/bootchart-start//写个50s进去
Restart can be run normally, you can see five files under/data/bootchart:
[Email protected]:/# Ll/data/bootchart-rw-rw-rw-root Root 517 -in-all : + H Eader-rw-r--r--root root 0 -in-all : + k Ernel_pacct-rwxr-xr-x root root 196608 -for-all :
17 Proc_diskstats.log
-rwxr-xr-x root root 3735552 -in-all : P Roc_ps.log-rwxr-xr-x root root 131072 -for-all :
17 Proc_stat.log
Package as Bootchart.tgz:
busybox tar zcvf bootchart.tgz header kernel_pacct proc_diskstats.log proc_ps.log proc_stat.log
ADB pull or copy it directly and put it on the PC.
Ubuntu can use Apt-get to install Bootchart, you can use Bootchart bootchart.tgz to parse into a chart, there may be errors, online someone gave a way to modify the corresponding Python script, not difficult.
Unfortunately I have not been under the Ubuntu, a lot of inconvenience--
Windows, you have to find a bootchart corresponding jar package, can be copied from the Ubuntu bootchart installation directory
java -jar bootchart.jar bootchart.tgz
Without error, you can get a picture of bootchart.png, the previous image:
The popular understanding is that the blue is CPU occupied, pink for IO Wait, that is, the time of the file operation, the horizontal axis is the starting time, in the process as a unit description.
Let's get here ~
Android--bootchart