This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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,  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...

    export LD_PROFILE_OUTPUT=/home/user/proftest
    g++ -g -fPIC -c -o prof.lo prof.cpp
    g++ --shared -o 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 just like I expect.

Running gprof, I get

    [gprof ptest]
    gprof: file `' has unsupported version 131071

Running sprof, I get

    Flat 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  0.00    0.00      0         __deregister_frame_info [0]
                  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?

Paul Braman

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]