sprof does not work with static functions

Arvind Ayyangar arvind.ayyangar@gmail.com
Tue Jul 17 13:27:00 GMT 2007


hi all,
               Issues with sprof seems to creep in all the time but there
seems to be no helpful discussion on the web.
       I would expect sprof to give me full information of the
functions it shows in the flat profile.

   I have a small library which has three functions foo() , temp() and
fun(). Function foo calls temp() and fun() which is a static function.
When I profile the library, I get partial information of the static
function viz fun. The static functions dont seems to appear in the
call graph and the call count is always displayed as zero.

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 50.00      0.17     0.17        1170000.00           temp
 50.00      0.34     0.17        0     0.00           fun
  0.00      0.34     0.00        1     0.00           foo

index % time    self  children    called     name

[0]      0.0    0.00    0.00        0         mcount@@GLIBC_2.0 [0]
                0.00    0.00        1/1           foo [3]
                0.17    0.00        1/1           temp [2]
-----------------------------------------------
                0.00    0.00        1/1           <UNKNOWN>
[2]     50.0    0.17    0.00        1         temp [2]
-----------------------------------------------
                0.00    0.00        1/1           <UNKNOWN>
[3]      0.0    0.00    0.00        1         foo [3]
-----------------------------------------------

I debugged to see if the static functions were calling mcount and they did.
Does glibc/ sprof handle static functions in a dif way? Is there any
workaround?


-- 
Arvind



More information about the Libc-alpha mailing list