valgrind,分析计时器已过期? [英] valgrind, profiling timer expired?

查看:26
本文介绍了valgrind,分析计时器已过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 valgrind 分析一个简单的 c prog:

I try to profile a simple c prog using valgrind:

[zsun@nel6005001 ~]$ valgrind --tool=memcheck ./fl.out
==2238== Memcheck,内存错误检测器
==2238== 版权所有 (C) 2002-2009 和 GNU GPL,由 Julian Seward 等人
==2238== 使用 Valgrind-3.5.0 和 LibVEX;使用 -h 重新运行以获取版权信息
==2238== 命令:./fl.out
==2238==
==2238==
==2238== 堆摘要:
==2238== 在退出时使用:1 个块中的 1,168 个字节
==2238== 总堆使用量:1 次分配,0 次释放,已分配 1,168 字节
==2238==
==2238== 泄漏摘要:
==2238== 肯定丢失了:0 个块中的 0 个字节
==2238== 间接丢失:0 个块中的 0 个字节
==2238== 可能丢失:0 个块中的 0 个字节
==2238== 仍然可以访问:1 个块中有 1,168 个字节
==2238== 被抑制:0 个块中的 0 个字节
==2238== 重新运行 --leak-check=full 以查看泄漏内存的详细信息
==2238==
==2238== 对于检测到和抑制的错误的计数,重新运行: -v
==2238== 错误摘要:0 个上下文中的 0 个错误(被抑制:8 个中的 12 个)
分析计时器已过期

[zsun@nel6005001 ~]$ valgrind --tool=memcheck ./fl.out
==2238== Memcheck, a memory error detector
==2238== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==2238== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==2238== Command: ./fl.out
==2238==
==2238==
==2238== HEAP SUMMARY:
==2238== in use at exit: 1,168 bytes in 1 blocks
==2238== total heap usage: 1 allocs, 0 frees, 1,168 bytes allocated
==2238==
==2238== LEAK SUMMARY:
==2238== definitely lost: 0 bytes in 0 blocks
==2238== indirectly lost: 0 bytes in 0 blocks
==2238== possibly lost: 0 bytes in 0 blocks
==2238== still reachable: 1,168 bytes in 1 blocks
==2238== suppressed: 0 bytes in 0 blocks
==2238== Rerun with --leak-check=full to see details of leaked memory
==2238==
==2238== For counts of detected and suppressed errors, rerun with: -v
==2238== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 8)
Profiling timer expired

我试图分析的 c 代码如下:

The c code I am trying to profile is the following:

void forloop(void){
    int fac=1;
    int count=5;
    int i,k;

    for (i = 1; i <= count; i++){
        for(k=1;k<=count;k++){
            fac = fac * i;
        }
    }
}

出现Profiling timer expired",是什么意思?如何解决这个问题呢?谢谢!

"Profiling timer expired" shows up, what does it mean? How to solve this problem? thx!

推荐答案

问题是您在使用 -pg 编译的程序上使用 valgrind.您不能同时使用 valgrind 和 gprof.如果您使用的是 Linux 并且需要在 valgrind 下分析程序的实际仿真,则 valgrind 手册建议使用 OProfile.

The problem is that you are using valgrind on a program compiled with -pg. You cannot use valgrind and gprof together. The valgrind manual suggests using OProfile if you are on Linux and need to profile the actual emulation of the program under valgrind.

这篇关于valgrind,分析计时器已过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆