和菜鸟一起学linux之linux性能分析工具oprofile移植


一、内核编译选项

make menuconfig

General setup--->
[*] Profiling support
<*> OProfile system profiling


二、popt移植

       下载源码:http://rpm5.org/files/popt/    popt-1.16.tar.gz

 

       解压缩后,在popt-1.16当前目录下,新建build.sh,编辑内容如下:

---------------------------------------分割线----------------------------------------------------

#!/bin/sh 
./configure  --host=arm-linux \ 
                 --prefix=/home/eastmoon/rootfs \
--target=arm-linux
 

---------------------------------------分割线----------------------------------------------------

设置下build.sh的权限后,

./build.sh 配置好以后,

make下,

再make install就ok了。

然后可以看到在/home/eastmoon/rootfs中就会有相关的.so等库了。


二、binutils移植

下载源码:http://ftp.gnu.org/gnu/binutils/   binutils-2.22.tar.gz

 

解压缩后,在binutils-2.22当前目录下,新建build.sh,编辑内容如下:

---------------------------------------分割线----------------------------------------------------

#!/bin/sh 
./configure  --host=arm-linux \ 
                 --with-kernel-support \
                 --prefix=/home/eastmoon/rootfs \
--target=arm-linux \
--disable-nls


---------------------------------------分割线----------------------------------------------------

设置下build.sh的权限后,

./build.sh 配置好以后,

修改gas/Makefile,WARN_CFLAGS中去掉-Werror

因为有些机器是64位的,编译的.a在oprofile中链接会有问题。所以,这时候

vim config.status

修改$[“CFLAGS”]=”-g–O2” 为 $[“CFLAGS”]=”-g–O2  -fPIC”.

 

接着

make下,

再make install就ok了。

然后可以看到在/home/eastmoon/rootfs中就会有相关的.so等库了。

 


三、oprofile移植

下载源码:http://oprofile.sourceforge.net/download/    oprofile-0.9.9.tar.gz

 

解压缩后,在oprofile-0.9.9当前目录下,新建build.sh,编辑内容如下:

---------------------------------------分割线----------------------------------------------------

#!/bin/sh 
CFLGAS+=-I//home/eastmoon/rootfs/include \
CXXFLGAS+=-I//home/eastmoon/rootfs/include\
LDFLGAS+=-L//home/eastmoon/rootfs/lib \
./configure  --host=arm-linux \ 
                 --with-kernel-support \
                 --prefix=/home/eastmoon/rootfs \
--target=arm-linux \
 

---------------------------------------分割线----------------------------------------------------

设置下build.sh的权限后,

./build.sh 配置好以后,

接着

make下,

再make install就ok了。

然后可以看到在/home/eastmoon/rootfs中就会有相关的应用程序了。

 

四、应用

编译的时候有指定的OPROFILE_EVENTS_DIR的路径。所以,在使用的时候

export  OPROFILE_EVENTS_DIR=’/home/oprofile’

 

       把/home/eastmoon/rootfs/share/oprofile下的文件,拷贝到/home/oprofile下。

 

最后,就可以使用oprofile了

opcontrol –setup–no-vmlinux

        opcontrol –init

        opcontrol –start  //启动

        opcontrol –dump  //采集

    opcontrol –stop   //停止

    opreport     //查看

    opreport –l   //查看,包括函数

具体的其他功能可以百度查看,这里只是移植和简单的应用。

转载于:https://www.cnblogs.com/wuyida/p/6299996.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值