开发者

Time Sampling Problems with gprof

开发者 https://www.devze.com 2023-01-14 05:45 出处:网络
I am attempting to profile some c++ code, compiled with g++ including the 开发者_开发问答option -pg, using gprof. However, in spite of the fact that the program takes 10-15 minutes to run on my comput

I am attempting to profile some c++ code, compiled with g++ including the 开发者_开发问答option -pg, using gprof. However, in spite of the fact that the program takes 10-15 minutes to run on my computer (with the CPU maxed out), the % time, cumulative seconds and self seconds columns of the table produced by gprof are entirely 0.00s! The calls column contains correct looking data, for example over 150,000 calls to a basic function. Here is a sample of the data collected:

  %   cumulative   self              self     total           

 time   seconds   seconds    calls  Ts/call  Ts/call  name

  0.00      0.00     0.00   156012     0.00     0.00  perm::operator[](int) const

  0.00      0.00     0.00   153476     0.00     0.00  perm::perm(void)

The program doesn't use strings and the only #include is iostream (only used for outputting the final answer) so it can't be slow because of string finds and compares or other similar slow external functions as suggested in this question: unable to accumulate time using gprof - the gnu profiler

The program itself exits fine and I have no reason to believe that the profile data isn't being written correctly (as was suggested here: gprof reports no time accumulated)

As this is all being done in windows 7, trying to use Shark or Valgrind isn't an option.

Is there a reason that it is recording 0.00s being spent in each function?


gprof doesn't count any blocked time, like I/O or other stuff. Also "self time" typically is extremely small in any routine that does all its work in subfunctions, like if you're mostly using a library in a DLL where gprof can't see it. Check this answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消