问题描述
我正在尝试使用gprof评估计算时间。我使用以下命令编译了代码,然后运行它,效果很好。但是在尝试评估时,显示为0 cpu时间。
a)gcc -pg -o process_basic process_basic.c
b)./process_basic
c)gprof -b process_basic
Flat profile:
Each sample counts as 0.01 seconds.
no time accumulated
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 5 0.00 0.00 display_int_var
0.00 0.00 0.00 5 0.00 0.00 increment
Call graph
granularity: each sample hit covers 2 byte(s) no time propagated
index % time self children called name
0.00 0.00 5/5 main [10]
[1] 0.0 0.00 0.00 5 display_int_var [1]
0.00 0.00 5/5 increment [2]
-----------------------------------------------
0.00 0.00 5/5 display_int_var [1]
[2] 0.0 0.00 0.00 5 increment [2]
-----------------------------------------------
Index by function name
[1] display_int_var [2] increment
它还生成了gmon.out,大小为601字节。我正在使用Ubuntu 18.04.2 LTS。
知道为什么值是0吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)