Linux oprofile命令
2015-11-19 00:54
525 查看
一、简介
oProfile是Linux平台上的一个功能强大的性能分析工具,支持两种采样(sampling)方式:基于事件的采样(eventbased)和基于时间的采样(timebased),它可以工作在不同的体系结构上,包括MIPS、ARM、IA32、IA64和AMD。
二、安装 1)打开内核OPROFILE选项,否则运行oProfile将提示:
如下:
3)编译内核并重启机器
4)下载源码,编译安装
三、工具集
四、使用步骤
1)启动检测
2)运行程序
3)停止检测
4)检测结果
五、oprofile实例
1)应用程序性能测试
2)内核模块性能测试
六、常见问题
1)oprofile抓不到数据
oProfile是Linux平台上的一个功能强大的性能分析工具,支持两种采样(sampling)方式:基于事件的采样(eventbased)和基于时间的采样(timebased),它可以工作在不同的体系结构上,包括MIPS、ARM、IA32、IA64和AMD。
二、安装 1)打开内核OPROFILE选项,否则运行oProfile将提示:
[root@localhost oprofile-0.9.6]# opcontrol --init FATAL: Module oprofile not found. FATAL: Module oprofile not found. Kernel doesn't support oprofile2)编辑内核配置文件:.config,将其中的# CONFIG_OPROFILE is not set改为CONFIG_OPROFILE=m(或者y)
[root@localhost ~]# cd /usr/src/linux-2.6.37.2 [root@localhost linux-2.6.37.2]# vi .config
如下:
CONFIG_PROFILING=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y CONFIG_PCI_IOAPIC=y
3)编译内核并重启机器
http://www.linuxidc.com/Linux/2014-10/108768.htm
4)下载源码,编译安装
wget http://cznic.dl.sourceforge.net/project/oprofile/oprofile/oprofile-1.0.0/oprofile-1.0.0.tar.gz
tar -zxvf oprofile-1.0.0.tar.gz cd oprofile-1.0.0 ./configure make make install
三、工具集
ophelp: 列出所有支持的事件。 opcontrol: 设置需要收集的事件。 opreport: 对结果进行统计输出。 opannaotate:产生带注释的源/汇编文件,源语言级的注释需要编译源文件时的支持。 opstack: 产生调用图profile,但要求x86/2.6的平台,并且linux2.6安装了call-graph patch opgprof: 产生如gprof相似的结果。 oparchive: 将所有的原始数据文件收集打包,可以到另一台机器上进行分析。 op_import: 将采样的数据库文件从另一种abi转化成本地格式。
四、使用步骤
1)启动检测
modprobe oprofile timer=1 opcontrol --no-vmlinux opcontrol --separate=kernelopcontrol --init opcontrol --reset opcontrol –start
2)运行程序
运行测试程序
3)停止检测
opcontrol --dump opcontrol --stop opcontrol --shutdown opcontrol --deinit
4)检测结果
opreport opreport -l ./test opannotate --source ./test
五、oprofile实例
1)应用程序性能测试
/article/5024067.html
2)内核模块性能测试
http://www.oenhan.com/oprofile-cpu-analysis
六、常见问题
1)oprofile抓不到数据
http://blog.csdn.net/cybertan/article/details/8015611
参考:http://blog.chinaunix.net/uid-21768364-id-186057.html
/article/5024067.html
http://www.oenhan.com/oprofile-cpu-analysis
相关文章推荐
- linux常用命令——rm删除命令
- Linux用户配置sudo权限(visudo)
- Linux__ssh服务开启_me
- Linux下MySQL数据库常用基本操作 一
- linux简单磁盘操作
- Linux 下java jdk安装
- 【原】Centos 6 搭建WordPress所需要的软件包
- Android Linux 常用命令
- Linux/Ubuntu下限制用户在特定目录的权限
- Linux/Ubuntu下安装svn(一)
- linux下的软链接
- 防火墙的关闭开启[linux]
- Linux:JDK安装配置【Centos7】
- centos 之静态IP
- Linux:修改主机名【Centos7】
- centos打包zip
- Linux防火墙【Centos7】
- Find命令【Linux】
- Linux虚拟机中 Node.js 开发环境搭建
- Linux用cmake编译c++