1

我们使用 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 并生成不需要的警告

4

1 回答 1

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...”。只要您确定您测量的内容与现在安装的二进制文件相匹配,您看到的警告就是无害的。

于 2012-08-22T03:09:40.700 回答