微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

gprof显示0计算时间

如何解决gprof显示0计算时间

我正在尝试使用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 举报,一经查实,本站将立刻删除。