bootchart
来源:互联网 发布:unity3d 跳转场景 编辑:程序博客网 时间:2024/05/28 05:16
1、bootchart工具简介:
bootchart是一个用于linux启动过程性能分析的开源软件工具,在系统启动过程自动收集CPU占用率、进程等信息,并以图形方式显示分析结果,可用作指导优化系统启动过程。
2、bootchart在Android平台使用情况:
Android系统中已有一份bootchart的c实现,位于system/core/init/bootchart.c中。bootchart对Android开机测量是通过内建在init进程中实现的,在后台执行测量。不过bootchart的测量时段是从bootchart被初始化之后到home screen出来之前,不包括bootloader和kernel的执行时间(bootchart的原理是取代init process或是内建在init process里,所以只能取得initial script的开机过程报告)。
3、bootchart在Android平台使用步骤:
1) Ubuntu 12.04下bootchart工具安装
2) bootchart在Android下编译
3) bootchart在Android下的应用
4) bootchart测量结果图形化显示
下面依次对上述4个步骤做详细说明
1)、Ubuntu 12.04下bootchart工具安装:
网上很多教程说要安装下面两个工具,经个人验证最后在制作图形化显示时,出现bootchart无法正常解析android中生成的bootchart.tgz文件。
[java] view plain copy
sudo apt-get install bootchart
sudo apt-get install pybootchartgui
异常情况如下,需要下载旧版本的bootchart工具,最终问题得到解决。
下载bootchart_0.9-0ubuntu6_all.deb工具,下载地址:http://download.csdn.net/detail/sckgenius/7166477
安装方法:sudo dpkg -i bootchart_0.9-0ubuntu6_all.ded
2)、bootchart在Android下编译:
1、 vi system/core/init/bootchart.h 修改define BOOTCHART 0 为 define BOOTCHART 1
[cpp] view plain copy
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BOOTCHART_H
#define _BOOTCHART_H
#ifndef BOOTCHART
# define BOOTCHART 0 // 修改define BOOTCHART 1
#endif
#if BOOTCHART
extern int bootchart_init(void);
extern int bootchart_step(void);
extern void bootchart_finish(void);
# define BOOTCHART_POLLING_MS 200 /* polling period in ms */
# define BOOTCHART_DEFAULT_TIME_SEC (2*60) /* default polling time in seconds */
# define BOOTCHART_MAX_TIME_SEC (10*60) /* max polling time in seconds */
#endif /* BOOTCHART */
#endif /* _BOOTCHART_H */
2、添加bootchart进入系统中,执行如下命令:
[html] view plain copy
touch system/core/init/init.c
export INIT_BOOTCHART=true
其中touch命令的作用就是将init.c文件的最后修改时间改为当前时间,这样保证init.c文件会被重新make,而bootchart就是在init.c中被调用的,从而保证bootchart会被编进系统中,重新编译固件编译生成新的可执行文件init,该文件在手机文件系统位于根/下,对应的flash image是boot.img,为此需重新烧写含有新的init的boot.img。
3) bootchart在Android下的应用:
1、将编译生成的带有bootchart工具的Android系统重新烧录到开发板上,并启动系统。
2、在系统data目录创建文件/data/bootchart-start,其内容是bootchart的采样时间:
[html] view plain copy
adb shell 'echo $TIMEOUT > /data/bootchart-start'
其中$TIMEOUT是期望采样的时间,单位为秒,例如要采样两分钟,则执行:
[html] view plain copy
adb shell 'echo 120 > /data/bootchart-start'
3、在系统data目录创建/data/bootchart,执行
[html] view plain copy
adb shell 'mkdir /data/bootchart'
在开发板上系统的/data/目录下新建目录bootchart/用来存放bootchart的测量结果,后面要利用这些文件生成可视化图片。
4、重新启动开发板,在开发板的Android系统的/data/bootchart/目录下将看到以下5个文件组成:
到此为止,bootchart执行测量后生成的测量数据已经完成,看上面有3个.log文件,下面进行生成美观的图形化显示。
需要注意,在开发板上运行bootchart采样完成后若不再使用bootchart则需手工删除文件/data/bootchart-start,否则开发板每次重启时都会运行bootchart。
4) bootchart测量结果图形化显示:
1、生成bootchart.tgz 在data/bootchart目录执行以下命令:
[html] view plain copy
busybox tar -czf bootchart.tgz *
或者使用android源码打包工具中提供的 grab-bootchart.sh文件进行打包,源码路径:system/core/init/grab-bootchart.sh
2、生成美观的图形化显示
拷贝/data/bootchart下刚才生成的 bootchart.tgz到Linux环境下,执行:
[html] view plain copy
java -jar /usr/share/bootchart/bootchart.jar /path/bootchart.tgz
执行上面命名会在/path目录生成一个bootchart.svgz 问题,下面对其进行重命名
[html] view plain copy
sudo mv bootchart.svgz bootchart.svg.gz
重命名完成后执行
[html] view plain copy
sudo gzip -d bootchart.svg.gz
此时会发现在path目录生成名为bootchart.svg图片,到此大功告成,美观的图形化显示show出来了。
三 制作png图片
1.在ubuntu系统安装bootchart工具,sudo apt-get install bootchart
2.执行 bootchart bootchart.tar 会在当前目录下生产bootchart.png
#!/bin/sh
#
# this script is used to retrieve the bootchart log generated
# by init when compiled with INIT_BOOTCHART=true.
#
# for all details, see //device/system/init/README.BOOTCHART
#
TARBALL=bootchart.tgz
FILES="header proc_stat.log proc_ps.log proc_diskstats.log"
tar -czf $TARBALL $FILES
bootchart $TARBALL
gnome-open ${TARBALL%.tgz}.png
bootchart是一个用于linux启动过程性能分析的开源软件工具,在系统启动过程自动收集CPU占用率、进程等信息,并以图形方式显示分析结果,可用作指导优化系统启动过程。
2、bootchart在Android平台使用情况:
Android系统中已有一份bootchart的c实现,位于system/core/init/bootchart.c中。bootchart对Android开机测量是通过内建在init进程中实现的,在后台执行测量。不过bootchart的测量时段是从bootchart被初始化之后到home screen出来之前,不包括bootloader和kernel的执行时间(bootchart的原理是取代init process或是内建在init process里,所以只能取得initial script的开机过程报告)。
3、bootchart在Android平台使用步骤:
1) Ubuntu 12.04下bootchart工具安装
2) bootchart在Android下编译
3) bootchart在Android下的应用
4) bootchart测量结果图形化显示
下面依次对上述4个步骤做详细说明
1)、Ubuntu 12.04下bootchart工具安装:
网上很多教程说要安装下面两个工具,经个人验证最后在制作图形化显示时,出现bootchart无法正常解析android中生成的bootchart.tgz文件。
[java] view plain copy
sudo apt-get install bootchart
sudo apt-get install pybootchartgui
异常情况如下,需要下载旧版本的bootchart工具,最终问题得到解决。
下载bootchart_0.9-0ubuntu6_all.deb工具,下载地址:http://download.csdn.net/detail/sckgenius/7166477
安装方法:sudo dpkg -i bootchart_0.9-0ubuntu6_all.ded
2)、bootchart在Android下编译:
1、 vi system/core/init/bootchart.h 修改define BOOTCHART 0 为 define BOOTCHART 1
[cpp] view plain copy
*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BOOTCHART_H
#define _BOOTCHART_H
#ifndef BOOTCHART
# define BOOTCHART 0 // 修改define BOOTCHART 1
#endif
#if BOOTCHART
extern int bootchart_init(void);
extern int bootchart_step(void);
extern void bootchart_finish(void);
# define BOOTCHART_POLLING_MS 200 /* polling period in ms */
# define BOOTCHART_DEFAULT_TIME_SEC (2*60) /* default polling time in seconds */
# define BOOTCHART_MAX_TIME_SEC (10*60) /* max polling time in seconds */
#endif /* BOOTCHART */
#endif /* _BOOTCHART_H */
2、添加bootchart进入系统中,执行如下命令:
[html] view plain copy
touch system/core/init/init.c
export INIT_BOOTCHART=true
其中touch命令的作用就是将init.c文件的最后修改时间改为当前时间,这样保证init.c文件会被重新make,而bootchart就是在init.c中被调用的,从而保证bootchart会被编进系统中,重新编译固件编译生成新的可执行文件init,该文件在手机文件系统位于根/下,对应的flash image是boot.img,为此需重新烧写含有新的init的boot.img。
3) bootchart在Android下的应用:
1、将编译生成的带有bootchart工具的Android系统重新烧录到开发板上,并启动系统。
2、在系统data目录创建文件/data/bootchart-start,其内容是bootchart的采样时间:
[html] view plain copy
adb shell 'echo $TIMEOUT > /data/bootchart-start'
其中$TIMEOUT是期望采样的时间,单位为秒,例如要采样两分钟,则执行:
[html] view plain copy
adb shell 'echo 120 > /data/bootchart-start'
3、在系统data目录创建/data/bootchart,执行
[html] view plain copy
adb shell 'mkdir /data/bootchart'
在开发板上系统的/data/目录下新建目录bootchart/用来存放bootchart的测量结果,后面要利用这些文件生成可视化图片。
4、重新启动开发板,在开发板的Android系统的/data/bootchart/目录下将看到以下5个文件组成:
到此为止,bootchart执行测量后生成的测量数据已经完成,看上面有3个.log文件,下面进行生成美观的图形化显示。
需要注意,在开发板上运行bootchart采样完成后若不再使用bootchart则需手工删除文件/data/bootchart-start,否则开发板每次重启时都会运行bootchart。
4) bootchart测量结果图形化显示:
1、生成bootchart.tgz 在data/bootchart目录执行以下命令:
[html] view plain copy
busybox tar -czf bootchart.tgz *
或者使用android源码打包工具中提供的 grab-bootchart.sh文件进行打包,源码路径:system/core/init/grab-bootchart.sh
2、生成美观的图形化显示
拷贝/data/bootchart下刚才生成的 bootchart.tgz到Linux环境下,执行:
[html] view plain copy
java -jar /usr/share/bootchart/bootchart.jar /path/bootchart.tgz
执行上面命名会在/path目录生成一个bootchart.svgz 问题,下面对其进行重命名
[html] view plain copy
sudo mv bootchart.svgz bootchart.svg.gz
重命名完成后执行
[html] view plain copy
sudo gzip -d bootchart.svg.gz
此时会发现在path目录生成名为bootchart.svg图片,到此大功告成,美观的图形化显示show出来了。
三 制作png图片
1.在ubuntu系统安装bootchart工具,sudo apt-get install bootchart
2.执行 bootchart bootchart.tar 会在当前目录下生产bootchart.png
#!/bin/sh
#
# this script is used to retrieve the bootchart log generated
# by init when compiled with INIT_BOOTCHART=true.
#
# for all details, see //device/system/init/README.BOOTCHART
#
TARBALL=bootchart.tgz
FILES="header proc_stat.log proc_ps.log proc_diskstats.log"
tar -czf $TARBALL $FILES
bootchart $TARBALL
gnome-open ${TARBALL%.tgz}.png
阅读全文
0 0
- BootChart
- bootchart
- bootchart
- Android Bootchart
- [Android]bootchart
- bootchart使用说明
- Bootchart使用
- bootchart 系统启动速度检测
- Build Android Bootchart
- Using Bootchart on Android
- Android bootchart使用步骤
- Android bootchart使用步骤
- bootchart实现分析
- Using Bootchart on Android
- Android bootchart 使用心得
- Android bootchart 工具使用
- Android——bootchart
- Android bootchart分析
- 二维码
- loction.search 通过地址栏实现页面之间的数据传输、接受、展示、处理方法
- PTCHECK查重好渣啊,还没有paperyy好用
- Java8新特性
- gu 252. Railway Communication (最小费用最大流) 输出方案
- bootchart
- 关于java 注解中元注解Inherited的使用详解
- maven install的Using platform encoding (GBK actually) to copy filtered resources解决方案
- 关于连续有限序列的非线性平滑
- office
- Windows+anaconda+labelme安装
- 动态模块加载和ELF loader
- java项目遇到风险漏洞示例与解决方案
- 谷歌拍照黑科技Pixel Visual Core:Pixel 2的图像处理和机器学习