使用gprof获取错误

问题描述 投票:0回答:2

我试图使用gprof来证明我们的软件,但是当我执行命令时

gprof <binary-name> gmon.out

我收到以下错误:

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

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

我究竟做错了什么?

gprof
2个回答
0
投票

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

-1
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.