Oprofile 移植
工具的编译参考
http://blog.csdn.net/louieuser/article/details/6152175
工具使用:
1.创建一个AVD,启动模拟器时,用我们编译好的kernel替换SDK自带的kernel
C:\Users\maricoliu>emulator @android2.3 -partition-size 300 -kernel ~\kernel-qemu
注:由于要向系统中push我们的程序,请分配足够的大小,否则会出现no space left on device错误,用-partition-size指定大小
2.安装busybox,Oprofile
将我们编译好的busybox和Oprofile装入模拟器
进入adb shell中,创建两个文件夹
#mkdir /data/busybox
#mkdir /data/oprofile
在控制台执行如下命令:
C:\Users\maricoliu>adb push ~\busybox /data/busybox/
Oprofile工具只要将以op开头的文件装入模拟器就可以:
C:\Users\maricoliu>adb push ~\oprofile\opcontrol /data/oprofile/
C:\Users\maricoliu>adb push ~\oprofile\opannotate /data/oprofile/
……(其余不再列出)
回到shell中,安装busybox,增加Oprofile文件的执行权限
#cd /data/busybox
#chmod 777 busybox
#./busybox –install busybox
#cd /data/oprofile
#chmod 777 op*
3.运行Oprofile
#export PATH=$PATH:/data/busybox
#export PATH=$PATH:/data/oprofile
# mount -o remount rw /
# mount -o rw,remount -t yaffs2 /dev/mtdblock3 /system
#ln -s /proc/mounts /etc/mtab (建立一个软连接,后面有说明)
# opcontrol --init //初始化,只需运行一次
# opcontrol --setup --callgraph=2 --session-dir=/result/ --no-vmlinux
# opcontrol --start
opcontrol --start
Using 2.6+ OProfile kernel interface.
Using log file /result/samples/oprofiled.log
Daemon started.
Profiler running.
# opcontrol --status
opcontrol --status
Daemon running: pid 773
Separate options: none
vmlinux file: none
Image filter: none
Call-graph depth: 2
运行你的程序
# opcontrol --dump //收集采样数据
# opcontrol --stop //停止profiler
Stopping profiling.
#opreport --session-dir=/result/ //查看报告
遇到的问题:
1.出现错误 :
test: not found
id: not found
test: not found
grep: not found
test: not found
grep: not found
test: not found
…………
这是由于 Android 提供的命令过于精简,因此需要移植 busybox ,来运行 opcontrol 。按照上面的步骤安装busybox后,任然出现此错误,google后得知,要修改 opcontrol 文件如下:
BINDIR =”/data/busybox”
PATH 中加入 /data/busybox
查看opcontrol源码后发下未加入/data/busybox,现以加入
2.出现错误
./opcontrol --init
grep: /etc/mtab: No such file or directory
grep: /etc/mtab: No such file or directory
Kernel support not available, missing opcontrol --init as root
# touch /etc/mtab
# ./opcontrol --init
Kernel support not available, missing opcontrol --init as root ?
通过对 opcontrol 的分析发现它是通过对执行" grep oprofile /proc/modules >/dev/null " 的返回值为判断条件还进行操作的,开始由于 mtab 文件里没有 oprofile 的相关信息,所以要执行 "mount -t oprofilefs nodev /dev/oprofile >/dev/null" 而linux 标准文件系统在执行了此命令之后将会与之相关的 mount 信息写入 /etc/mtab 中,而执行了umount 之后相关信息将从/etc/mtab文件中删除,而通过相关的操作之后发busybox系统中的 mtab 文件并无任何改变,通过google 之后知道原来新的busybox 使用 /proc/mounts 代替了 /etc/mtab,故在/etc 下建一个指 /proc/mounts 名为 mtab 的链接就绕过这个问题
# ln –s /proc/mounts /etc/mtab
可能会遇到link failed file exists错误,请确保/etc/目录下面没有mtab文件,有的话删除
分享到:
相关推荐
oprofile 移植到板端 oprofile 移植
oprofile 移植到 xscale-pxa-255开发板,Linux内核采用Android的,希望对看到的人有所作用。;)
Oprofile在Android中的应用.pdf
Edwin.Rong达人总结的文章,对oprofile的移植很有帮助,在这共享出来,方便你我!:)
对oproflie的使用做了非常详细的说明,很清楚,是学习oprofie工具的必备文档,oprofile是linux/adroid下必备的性能分析工具
Oprofile 用户手册,Oprofile user manual.pdf
oprofile 相关代码和使用说明 调试Linux程序必备
Oprofile 0.9.4 程序性能分析必备工具
oProfile是用于Linux的若干种评测和性能监控工具中的一种,它可以工作在不同的体系结构上,包括MIPS、ARM、IA32、IA64和AMD。oProfile包含在Linux2.5和更高版本的内核中,也包含在大多数较新的Linux版本中,包括...
Oprofile-0.9.7.tar.gz linux平台性能测试必备工具。
oprofile-0.9.5.tar.zip ,很经典的Linux系统资源分析工具。
在虚拟机和ubuntu(18.04)上安装运行oprofile0.9.9,具体方法参考https://blog.csdn.net/lizhengx/article/details/80748867
一款很强大的内核分析工具,技术开发者的福音,此文档详细得介绍了这款强大工具的使用方法。
官方离线安装包,测试可用。请使用rpm -ivh [rpm完整包名] 进行安装
oprofile 是linux下很长有用的性能分析工具,这个文档是oprofile官方网站提供的manual的pdf版
oprofile gprof 资源收集 资源收集
离线安装包,亲测可用
linux 强大的性能测试工具的用法 powerful tool and to profile a set of applications to understand the output from OProfile. This is an excellent tool to have in your toolbox.
离线安装包,亲测可用
离线安装包,亲测可用