Oprofile警告“无法检查二进制文件”

时间:2012-08-22 02:42:30

标签: linux linux-kernel oprofile

我们使用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是内核模块名称,因此填充标题始终将mtime填入0并生成不需要的警告

1 个答案:

答案 0 :(得分:1)

此失败表示相关文件的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";
  

它是否会影响oprofile输出的准确性,无论如何都要避免这种警告?

是的,它会影响输出,因为它没有机会警告你“the last modified time of the binary file does not match that of the sample file...”。只要您确定所测量的内容然后匹配现在安装的二进制文件,您所看到的警告就是无害的。