当前位置: 技术问答>linux和unix
gprof使用的问题
来源: 互联网 发布时间:2016-10-02
本文导语: 我在编译环境下,用-pg编译一个可执行程序,再放到运行环境中跑一下,生成gmon.out文件,再放到我的编译环境中用gprof分析,得到的结果不是inf就是nan。 不能这么用吗? 怎么才能正确地用gprof进行分析呢?请高手指教...
我在编译环境下,用-pg编译一个可执行程序,再放到运行环境中跑一下,生成gmon.out文件,再放到我的编译环境中用gprof分析,得到的结果不是inf就是nan。
不能这么用吗? 怎么才能正确地用gprof进行分析呢?请高手指教! 多谢!
另,编译环境和运行环境实际上都是redhat,区别只是运行环境是裁减过的系统。
[root@REdHAT ~]# gprof -b t1 gmon.out
Flat profile:
Each sample counts as inf seconds.
% cumulative self self total
time seconds seconds calls [s/call [s/call name
100.00 inf inf 1 inf inf b
0.00 inf nan 1 nan nan a
Call graph
granularity: each sample hit covers 4 byte(s) for 0.35% of inf seconds
index % time self children called name
inf nan 1/1 main [2]
[1] 100.0 inf nan 1 b [1]
-----------------------------------------------
[2] 100.0 nan inf main [2]
inf nan 1/1 b [1]
nan nan 1/1 a [3]
-----------------------------------------------
nan nan 1/1 main [2]
[3] 0.0 nan nan 1 a [3]
-----------------------------------------------
Index by function name
[3] a [1] b
不能这么用吗? 怎么才能正确地用gprof进行分析呢?请高手指教! 多谢!
另,编译环境和运行环境实际上都是redhat,区别只是运行环境是裁减过的系统。
[root@REdHAT ~]# gprof -b t1 gmon.out
Flat profile:
Each sample counts as inf seconds.
% cumulative self self total
time seconds seconds calls [s/call [s/call name
100.00 inf inf 1 inf inf b
0.00 inf nan 1 nan nan a
Call graph
granularity: each sample hit covers 4 byte(s) for 0.35% of inf seconds
index % time self children called name
inf nan 1/1 main [2]
[1] 100.0 inf nan 1 b [1]
-----------------------------------------------
[2] 100.0 nan inf main [2]
inf nan 1/1 b [1]
nan nan 1/1 a [3]
-----------------------------------------------
nan nan 1/1 main [2]
[3] 0.0 nan nan 1 a [3]
-----------------------------------------------
Index by function name
[3] a [1] b
|
nan Not a Number
inf infinity
参考http://blog.csdn.net/henhen2002/archive/2010/03/31/5431160.aspx
inf infinity
参考http://blog.csdn.net/henhen2002/archive/2010/03/31/5431160.aspx