我正在尝试使用gprof分析我的C ++应用程序,我想计算函数执行时间。但是,如果某些函数的运行速度超过0.01s,则会在gprof上报告值为0.00。如何将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 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]
-----------------------------------------------