Report shows “no time accumulated” for gprof using

2019-06-12 21:06发布

问题:

After compiling with flags: -O0 -p -pg -Wall -c on GCC and -p -pg on the MinGW linker, the eclipse plugin gprof for shows no results. After that I did a cmd call using gprof my.exe gmon.out > prof.txt, which resulted in a report witth only the number of calls to functions.

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    16000     0.00     0.00  vector_norm
  0.00      0.00     0.00       16     0.00     0.00  rbf_kernel
  0.00      0.00     0.00        8     0.00     0.00  lubksb

I've came across this topic: gprof reports no time accumulated. But my program is terminating in a clear maner. Also, gprof view show no data on MingW/Windows, but I am using 32 bits GCC. I have previously tried to use Cygwin, same result.

I am using eclipse Kepler with CDT version 8.3.0.201402142303 and MinGW with GCC 5.4.0.

Any help is appreciated, thank you in advance.

回答1:

Sorry for the question, seems that the code is faster than gprof can measure.

As my application involves a neural network train with several iterations and further testing of kernels, I didn't suspected that a fast code could be causing the problem. I inserted a long loop in the main body and the gprof time was printed.