【问题标题】:Getting error using gprof使用 gprof 出错
【发布时间】:2017-06-11 19:46:21
【问题描述】:

我正在尝试使用 gprof 分析我们的软件,但是当我执行命令时

gprof <binary-name> gmon.out

我收到以下错误:

gprof: dimension unit changed between histogram records
gprof: from 'seconds'
gprof: to ''

我假设我的二进制文件正在生成 gmon.out,因此,编译器必须在编译期间获得 -pg 开关。

我做错了什么?

【问题讨论】:

  • 尝试运行 gprof 而不提及 gmon.out,因为 gprof 从当前文件夹读取文件。

标签: gprof


【解决方案1】:

AmeyaVS 的评论已经暗示了答案:

# compile and link with -pg
gcc -pg file.c -o file

# run program to generate the gmon.out file
./file

# run gprof on your executable with matching gmon.out
gprof file gmon.out

【讨论】:

    【解决方案2】:

    尽量不要在守护进程或父子模式下运行您的应用程序。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-19
      • 2018-05-08
      • 1970-01-01
      • 1970-01-01
      • 2011-06-29
      • 2017-07-25
      相关资源
      最近更新 更多