Bootchart:android native comes with the boot performance viewing mechanism. By collecting various log data in the Android boot process, we can finally show the performance of each process during the boot process. (blog can not be broken ...) Writing is not easy, reprint need to indicate the source: http://blog.csdn.net/jscese/article/details/45933943 This article from the "Jscese" blog. Compiling Bootchart
Bootchart source code is located at: \system\core\init\bootchart.c belongs to Init
Look at the corresponding android.mk, among them:
ifeq ($(strip $(INIT_BOOTCHART)),true)LOCAL_SRC_FILES += bootchart.cLOCAL_CFLAGS += -DBOOTCHART=1endif
The very obvious variable control compiles, and the false assumption is to compile the Bootchart into init. Either export this variable to TRUE or define the assignment.
There is also a corresponding bootchart.h header file. Inside there is macro control, want to use Bootchart, how to change not to say more ~
The native boot is placed in the main of the init.c:
#if BOOTCHART"bootchart_init");#endif
Can see that the first run should be bootchart inside the bootchart_init this function
Can take a look at the source code of Bootchart, in which there is 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 must be the data partition to be mounted first, so the place to start Bootchart to be measured!
Using Bootchart
After the normal compilation into the system, you need to manually set up the above mentioned configuration:
50> /data/bootchart-start//写个50s进去
Reboot is possible. If you do this, you can see five files below/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. Put it on your PC.
Ubuntu can use Apt-get to install Bootchart. can use Bootchart bootchart.tgz to parse the chart. There may be errors. Someone on the internet has given a way to change 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 Ubuntu Bootchart installation folder
java -jar bootchart.jar bootchart.tgz
Without error, you can get a picture of bootchart.png, the previous image:
Popular understanding is that the blue CPU, pink for the IO Wait, that is, the time of the file operation, the horizontal axis for the starting time, the process as a unit descriptive narrative.
Let's get here ~
Android--bootchart