使用oprofile查找性能瓶颈

1>确定以下内核选项已选定:

CONFIG_OPROFILE

CONFIG_X86_LOCAL_APIC

CONFIG_X86_IO_APIC

CONFIG_PCI_IOAPIC


2> oprofile 命令

opcontrol --init #加载模块

opcontrol --vmlinux=/path/vmlinux #是否对kernel进行profiling
opcontrol --reset #清除当前会话中的数据
opcontrol --start #开始profiling

./progam #运行应用程序,oprofile会对它进行profiling

opcontrol --dump #把收集到的数据写入文件
opcontrol --stop #停止profiling
opcontrol --shutdown #关闭守护进程oprofiled
opcontrol --deinit #卸载模块

opcontrol -l # 列出当前可用监控事件.


opreport -l # 列出当前内核性能统计信息.
opannotate -s ./program # 列出引用程序性能统计信息


3. 问题处理

1> # ./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 ? 错误怎么解决?
# mount -o remount rw /
# mount -o rw,remount -t yaffs2 /dev/mtdblock3 /system
# touch /etc/mtab
# echo nodev /dev/oprofile oprofilefs rw 0 0>/etc/mtab

2> #./opcontrol --init
Kernel support not available, missing opcontrol --init as root ? 错误怎么解决?
检查/etc/mtab文件内容,确保是nodev /dev/oprofile oprofilefs rw 0 0

3> # opcontrol --init
opcontrol --init
cat: can't open '/dev/oprofile/cpu_type': No such file or directory
Unable to open cpu_type file for reading
Make sure you have done opcontrol --init
cpu_type 'unset' is not valid
you should upgrade oprofile or force the use of timer mode 错误怎么解决?
执行
# mount -t oprofilefs nodev /dev/oprofile
4> # opcontrol --start
mkdir: can't create directory '/var/': Read-only file system
Couldn't mkdir -p /var/lib/oprofile 错误怎么解决?
执行
# mount -o remount rw /
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值