使用oprofile查找性能瓶颈--错误及解决

来源:互联网 发布:算法设计的基本要素 编辑:程序博客网 时间:2024/04/28 17:17

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 /
原创粉丝点击