$opreport
opreport error: No sample file found: try running opcontrol --dump
or specify a session containing sample files
$tree /var/lib/oprofile/samples/current/
/var/lib/oprofile/samples/current/
0 directories, 0 files
确实是没抓到sample文件!
经过无数次的分析和判断,再加上goolge大神的帮助,找到问题的根源了:
$dmesg|grep oprofile
oprofile: using NMI timer interrupt.
#如果你的CPU不被oprofile认识,或者说认识有问题,oprofile就会进入 timer interrupt模式
#表现就是
$ophelp
Using timer interrupt.
$sudo opcontrol --setup -e CPU_CLK_UNHALTED:6000:0:0:1
You cannot specify any performance counter events
because OProfile is in timer mode.
如果你看到上面的字,对不起你肯定抓不到数据的,解决方案是这样的:
在oprofile模块加载的时候强制使用 timer=1.
$sudo opcontrol --deinit
Daemon not running
Unloading oprofile module
$sudo
modprobe oprofile
timer=1
$dmesg|grep oprofile|tail -n 1
oprofile: using timer interrupt.
如果你看到上面的字说明你成功了。
本文详细介绍了当使用OProfile进行性能分析时遇到无法抓取样本文件的问题及其解决方法。通过调整oprofile模块配置,从使用中断模式切换至定时器模式,最终成功解决了数据抓取问题。
4万+

被折叠的 条评论
为什么被折叠?



