gprof/sprof and shared libraries...again
Braman, Paul
Paul_Braman@tvratings.com
Thu Apr 4 13:15:00 GMT 2002
Okay, I did get a little further with the hints from Andrew Cagney.
To profile the calls to my library I made sure I compiled it with -pg.
gcc -pg -fPIC -I. -c -o prof.lo prof.c
gcc --shared -o libprof.so prof.lo
Now, I added the a few options to my call to sprof and seem to be getting
slightly closer...
sprof --flat-profile --graph libprof.so libprof.so.profile
This returns a flat profile that contains the symbol I am looking for, but
the call graph still won't show it like it would with profiling libc.so.6.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
100.00 0.50 0.50 0 0.00 something
index % time self children called name
0.00 0.00 0/0 <UNKNOWN>
[0] 0.0 0.00 0.00 0 mcount@@GLIBC_2.0 [0]
0.00 0.00 0/0 mcount@@GLIBC_2.0 [0]
Yes, "something" is the symbol I'm looking for, and I get timing on the
call, but it doesn't show up in the call graph. (Note that this much only
works when I *do not* compile my program with profiling. If I do compile my
executable with -pg, my symbol won't even show up in the flat profile
above.)
So, there's something...not sure what, but something.
Paul Braman
x5273
More information about the Binutils
mailing list