This is the mail archive of the
mailing list for the binutils project.
How to profile a multithreaded program using gprof?
- From: "Marcel Loose" <loose at astron dot nl>
- To: <binutils at sourceware dot org>
- Date: Fri, 30 Nov 2007 14:55:23 +0100
- Subject: How to profile a multithreaded program using gprof?
I've been trying to profile a multithreaded program, but have not been
successful so far. Profiling a single-threaded program, however, does not
pose any problems.
Basically, I already fail to get a working executable at all; not to mention
the fact the gprof does not support profiling of multiple threads by default.
When linking a multithreaded program against the profiling C library
(libc_p.a) I either get a `Segmentation fault' or a `Floating exception' upon
SuSE 10.0 (64-bit) : SIGSEGV in _dl_allocate_tls_init ()
SuSE 10.1 (64-bit) : SIGFPE in profil ()
Ubuntu 7.10 (32-bit): SIGSEGV in _dl_get_tls_static_info ()
When I try to use libpthread_p.a instead I get a bunch of link errors, that
basically tell me that the size of symbols like __flock_file are different
between libc_p.a and libpthread_p.a. What the ...?
Ok, suppose I could solve this problem (I don't know how, but suppose), then I
could enable support for profiling multiple threads, using Sam Hocevar's
`gprof-helper.c' (http://sam.zoy.org/writings/programming/gprof.html). But
then, the dynamic loader sends me to misery land when I've linked my program
against libc_p; it fails to dynamically load the pthread_create symbol at
Does anyone have a suggestion on how to profile a multithreaded application?
Any help would be very much appreciated.