Min*_*xer 1 c profiling gperftools
我正在使用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
$
Run Code Online (Sandbox Code Playgroud)
我错了什么?什么是profile.ftab文件?
你没有使用正确的'pprof'工具.特别是,您使用的是http://www.cs.uoregon.edu/research/tau/docs/newguide/bk03ch01s08.html(完全不相关),而您需要这里的一个:https:// code. google.com/p/gperftools/ 我有同样的问题并通过下载gperftools的源代码,构建它并使用./src/pprof解决了这个问题
我刚刚遇到了这个问题,我认为值得一提的是如何在最新版本的 Ubuntu(特别是 18.04)中处理这个问题。
当尝试运行该pprof命令时,系统建议安装该tau软件包:
Command 'pprof' not found, but can be installed with:
sudo apt install tau
Run Code Online (Sandbox Code Playgroud)
但是不要安装那个包,因为它与大卫卡尼在他的回答中指出的完全无关。google-perftools而是安装包,但请注意,其中的可执行文件被调用google-pprof而不仅仅是pprof.