2

I used gprof to get a profile of a c code which is running too slowly. Here is what I get:

Flat profile:
Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
100.05      0.16     0.16                             etext
  0.00      0.16     0.00    90993     0.00     0.00  Nel_wind
  0.00      0.16     0.00    27344     0.00     0.00  calc_crab_dens
  0.00      0.16     0.00    17472     0.00     0.00  Nel_radio
  0.00      0.16     0.00     1786     0.00     0.00  sync
  0.00      0.16     0.00        1     0.00     0.00  _fini
  0.00      0.16     0.00        1     0.00     0.00  calc_ele
  0.00      0.16     0.00        1     0.00     0.00  ic
  0.00      0.16     0.00        1     0.00     0.00  initialize
  0.00      0.16     0.00        1     0.00     0.00  make_table

I don't know what does "etext" mean and why is it taking 100.05% of time running. Thanks for your help!

pulsar_hh
  • 125
  • 2
  • 9

1 Answers1

1

I was having a similar issue and it was caused by me calling gprof with a different executable.

The accident occurred because I was recompiling with different options and naively called gprof with the same executable name on two different gmon.out files that were generated with different executables.

gprof exec1 exec1.gmon.out # Good, expected output
gprof exec1 exec2.gmon.out # Weird etext function with 0 calls, but lots of time consumed

Make sure you're not doing something similar.

Joseph Glover
  • 330
  • 3
  • 11