【问题标题】:Can't analyse the output (the profile file) of gperftools profiler无法分析 gperftools profiler 的输出(配置文件)
【发布时间】:2014-07-28 00:30:30
【问题描述】:

我正在使用gperftools 来分析我的 C 代码。结果我无法使用pprof 应用程序分析配置文件。

$ gcc -g prog.c -o prog -lprofiler
$ export CPUPROFILE=info.prof
$ ./prog 

 Inside main()

 Inside func1 

 Inside new_func1()

 Inside func2 
PROFILE: interrupts/evictions/bytes = 1133/0/300
$ ls
info.prof  prog  prog.c
$ ls -lah info.prof 
-rw-rw-r-- 1 mm mm 2.6K Jun  6 09:36 info.prof
$ pprof info.prof prog
Reading Profile files in profile.*
Error: Could not open profile.0.0.0: No such file or directory
profile.ftab: No such file or directory
$ 

我做错了什么? profile.ftab 文件是什么?

【问题讨论】:

  • 不是反过来吗pprof ./prog info.prof?
  • 不,pprof ./prog info.prof 命令也不起作用。
  • 错误信息长什么样?
  • 类似:读取配置文件中的配置文件。*错误:无法打开配置文件。0.0.0:没有这样的文件或目录 profile.ftab:没有这样的文件或目录

标签: c profiling gperftools


【解决方案1】:

您没有使用正确的“pprof”工具。特别是,您使用的是http://www.cs.uoregon.edu/research/tau/docs/newguide/bk03ch01s08.html(完全不相关),而您在这里需要一个:https://code.google.com/p/gperftools/ 我遇到了同样的问题,并通过下载 gperftools 的源代码、构建它并使用 ./ src/pprof

【讨论】:

    【解决方案2】:

    我刚刚遇到这个问题,我认为值得一提的是如何在最新版本的 Ubuntu(特别是 18.04)中处理这个问题。

    当尝试运行pprof 命令时,系统建议安装tau 包:

    Command 'pprof' not found, but can be installed with:
    
    sudo apt install tau
    

    但不要安装该软件包,因为正如大卫卡尼在他​​的回答中指出的那样,它完全不相关。请安装 google-perftools 包,但请注意其中的可执行文件名为 google-pprof 而不仅仅是 pprof

    【讨论】:

      【解决方案3】:

      你安装了错误的 pprof。

      如果你已经安装了 golang。您可以使用 go 安装 pprof。 就这样吧,

      去 github.com/google/pprof

      如果您想使用生成 PDF,也请安装 graphviz

      sudo apt-get install graphviz

      【讨论】:

        猜你喜欢
        • 2018-04-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-22
        • 1970-01-01
        • 2017-12-24
        • 2015-09-21
        • 1970-01-01
        相关资源
        最近更新 更多