oprofile 在android中的交叉编译及使用方法2

  转载

Android 使用Oprofile分析结果系统瓶颈

来自  Fgamers

2011年 2月 28日

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值