如何在纳秒内生成gprof报告? 我试图对我的C++应用程序进行配置,使用GPROF来计算函数执行时间。但是,如果某些函数的运行速度超过0.01秒,则会在gprof上报告值为0.00。如何将gprof的报告时间更改为纳秒
谢谢你的建议如何在纳秒内生成gprof报告? 我试图对我的C++应用程序进行配置,使用GPROF来计算函数执行时间。但是,如果某些函数的运行速度超过0.01秒,则会在gprof上报告值为0.00。如何将gprof的报告时间更改为纳秒,c++,gprof,C++,Gprof,谢谢你的建议 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
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 3 0.00 0.00 access_counter
0.00 0.00 0.00 2 0.00 0.00 get_counter
0.00 0.00 0.00 1 0.00 0.00 start_counter
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
.....
Call graph (explanation follows)
granularity: each sample hit covers 2 byte(s) no time propagated
index % time self children called name
0.00 0.00 1/3 start_counter [3]
0.00 0.00 2/3 get_counter [2]
[1] 0.0 0.00 0.00 3 access_counter [1]
-----------------------------------------------
0.00 0.00 2/2 main [9]
[2] 0.0 0.00 0.00 2 get_counter [2]
0.00 0.00 2/3 access_counter [1]
-----------------------------------------------
0.00 0.00 1/1 main [9]
[3] 0.0 0.00 0.00 1 start_counter [3]
0.00 0.00 1/3 access_counter [1]
-----------------------------------------------
我不确定,但我假设gprof的报告分辨率与它记录样本的分辨率相同。为了解决这个问题,使用一个运行时间更长的测试用例。我相信有一种方法可以设置报告时间分辨率,可以通过gprof选项或其他方式。实际上,实时应用程序中的大多数函数在处理数千条消息时运行得非常非常快。必须有一些方法来分析他们!