This is the mail archive of the
mailing list for the binutils project.
gprof/sprof and shared libraries...again
- From: "Braman, Paul" <Paul_Braman at tvratings dot com>
- To: "'binutils at sources dot redhat dot com'" <binutils at sources dot redhat dot com>
- Date: Thu, 4 Apr 2002 09:00:40 -0500
- Subject: gprof/sprof and shared libraries...again
This discussion seems to creep up from time to time but I haven't seen
anyone post positive results (that I can replicate).
Our RedHat installation here at work is a slightly modified 7.2 (we have a
RedHat contractor on-site who's coordinating our setup). I can't seem to
get a profile for a shared library the way I think I should.
First off, what I expect as output from my work is not a profile of the
calls *in* the library, but a profile of the calls *to* the library. (The
linker knows what calls are being made to the library and should be able to
put timing information around those calls.)
I've got a small library with one function, libprof.so. I've got a small
main that calls an internal function once and a function from the library
once. I can get a profile for the call to the internal function just fine,
but nothing I've done has generated information for a call to the function
in the library.
Commands I am running...
g++ -g -fPIC -c -o prof.lo prof.cpp
g++ --shared -o libprof.so prof.lo
g++ -g -pg -I/home/user/proftest -c -o ptest.o ptest.cpp
g++ -pg -o ptest ptest.o -L/home/user/proftest -lprof \
-Xlinker -rpath -Xlinker /home/user/proftest
This generates both gmon.out and libprof.so.profile just like I expect.
Running gprof, I get
[gprof ptest libprof.so.profile]
gprof: file `libprof.so.profile' has unsupported version 131071
Running sprof, I get
[sprof libprof.so libprof.so.profile]
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
index % time self children called name
0.00 0.00 0/0 <UNKNOWN>
 0.0 0.00 0.00 0 __deregister_frame_info 
0.00 0.00 0/0 __deregister_frame_info
I can't seem to get timing information for the call to the library function
regardless of what I've tried.
Any assistance or clarification available?