This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: profiling a MT-App (with shared libs) on Linux


>>>>> Lothar Werzinger writes:

 > Hi,
 > has anybody being successfully using the profiling support of gcc with a
 > multithreaded app on Linux. The code I want to profile is inside a
 > shared library, that gets loaded manually by the application program. I
 > have the source to both the app and the lib. Due to some architectual
 > constraints I can NOT statically link the library.

Use LD_PROFILE=libsomething.so, e.g.:

$ LD_PROFILE=libc.so.6 ls
[..]
$ sprof libc.so.6 libc.so.6.profile
Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
  0.00      0.00     0.00     2958     0.00           __overflow
  0.00      0.00     0.00     1782     0.00           strncmp
  0.00      0.00     0.00      788     0.00           strcmp
  0.00      0.00     0.00      723     0.00           mempcpy
  0.00      0.00     0.00      314     0.00           memcpy
[...]


LD_PROFILE_OUTPUT determines the path where it's written - this only
works with glibc 2.1 and newer.  AFAIR it should work with
multithreaded apps - if not complain on the glibc lists.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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