我们使用 Oprofile 对内核模块进行分析,并且在 opreport 中有如下警告
warning: could not check that the binary file /lib/modules/2.6.32-191.el6.x86_64/kernel/fs/ext4/ext4.ko has not been modified since the profile was taken. Results may be inaccurate.
1591 samples % symbol name
1592 1622 9.8381 ext4_iget
1593 1591 9.6500 ext4_find_entry
1594 1231 7.4665 __ext4_get_inode_loc
1595 783 4.7492 ext4_ext_get_blocks
1596 752 4.5612 ext4_check_dir_entry
1597 644 3.9061 ext4_mark_iloc_dirty
1598 583 3.5361 ext4_get_blocks
1599 583 3.5361 ext4_xattr_get
谁能解释一下这个警告是什么,它会影响 oprofile 输出的准确性吗?无论如何都可以避免这个警告吗?
如有任何建议,我们将不胜感激。非常感谢!
添加更多信息:
在 daemon/opd_mangling.c
if (!sf->kernel)
binary = find_cookie(sf->cookie);
else
binary = sf->kernel->name;
...
fill_header(odb_get_data(file), counter,
sf->anon ? sf->anon->start : 0, last_start,
!!sf->kernel, last ? !!last->kernel : 0,
spu_profile, sf->embedded_offset,
binary ? op_get_mtime(binary) : 0);
对于内核模块文件,sf->kernel->name
是内核模块名,所以fill header总是用0填充mtime
并生成不需要的警告
最佳答案
此失败表示相关文件的 stat
失败。执行 strace -e stat
以查看具体的故障模式。
time_t op_get_mtime(char const * file)
{
struct stat st;
if (stat(file, &st))
return 0;
return st.st_mtime;
}
...
if (!header.mtime) {
// FIXME: header.mtime for JIT sample files is 0. The problem could be that
// in opd_mangling.c:opd_open_sample_file() the call of fill_header()
// think that the JIT sample file is not a binary file.
if (is_jit_sample(file)) {
cverb << vbfd << "warning: could not check that the binary file "
<< file << " has not been modified since "
"the profile was taken. Results may be inaccurate.\n";
does it impact the accuracy of the oprofile output and is there anyway to avoid this warning?
是的,它会影响输出,因为它没有机会警告您“二进制文件的最后修改时间与样本文件的最后修改时间不匹配...
”。只要您确定测量的内容与现在安装的二进制文件相匹配,您看到的警告是无害的。
关于linux - Oprofile 警告 "could not check that the binary file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12065706/