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 was compiled. Suppose you want to compile Bootchart into init, either export this variable to TRUE or define the assignment.
There is also a corresponding bootchart.h header file. 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 normal compilation into the system. You will need to manually set the configuration mentioned above:
50> /data/bootchart-start//写个50s进去
Reboot is OK, if done properly, 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 and put it on the PC.
Ubuntu can use Apt-get to install Bootchart, can use Bootchart bootchart.tgz to parse into a chart. There could be errors, and someone on the web gave a way to change the corresponding Python script. Not hard.
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:
The popular understanding is that Blue is CPU occupied, pink for IO Wait, that is, the time of file operation, the horizontal axis is the starting time. Describe the narrative in a process-based unit.
Let's get here ~
Android--bootchart