Android 使用Oprofile分析结果系统瓶颈
来自 Fgamers
2,491 次阅读 评论 (0)
弄了半天,Android Oprofile终于可以分析出结果了,下面把使用过程记录一下。
1. 首先CPU PMU必须支持Oprofile机制,S3C6410并不支持,幸好telechips tcc8900支持。
make menuconfig。做如下选择
编译内核,在目标板上运行。启动信息中会看到如下信息
<6>oprofile: using arm/armv6
说明内核已经添加了oprofile支持
好了,下面我们在Android2.1上执行oprofile。
2. adb shell或者在Android串口终端中运行opcontrol –quick命令,初始化oprofiled。
然后执行opcontrol –start
如果执行opcontrol –status 显示如下
# opcontrol --status
opcontrol --status
Driver directory: /dev/oprofile
Session directory: /data/oprofile
Counter 0:
name: CPU_CYCLES
count: 150000
Counter 1 disabled
Counter 2 disabled
oprofiled pid: 1028
profiler is running
650 samples received
0 samples lost overflow
说明oprofile正在收集数据。
执行你想分析的程序。我运行了一个2D 测试软件。执行完毕后,运行opcontrol –stop。停止分析
3. 使用adb pull等方式,将目标板的/data/oprofile 拉出来,会看到里面包含一个samples文件夹,还有abi、complete_dump、lock三个文件,有用的是samples文件,其他三个文件不知道有什么用。
4.拷贝samples 文件夹到android源码的external/oprofile/result文件夹。result文件夹需要新建
5.需要执行opimprot_pull这个python脚本。由于脚本中使用了adb pull等方式,而我的linux环境上无法和目标板进行连接,最郁闷的是android自带的opimport等可执行文件无法从我的linux环境运行。因此改了一下脚本。
#!/usr/bin/python2.4 -E
import os
import re