From: Kurt Roeckx <Q@ping.be>
To: Mohit Aron <aron@cs.rice.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: gprof cannot profile multi-threaded programs
Date: Wed, 31 Jan 2001 15:17:20 +0100 [thread overview]
Message-ID: <20010131151720.A1386@ping.be> (raw)
In-Reply-To: <200101310531.XAA09534@cs.rice.edu>
In-Reply-To: <200101310531.XAA09534@cs.rice.edu>
On Tue, Jan 30, 2001 at 11:31:13PM -0600, Mohit Aron wrote:
> I analyzed the problem to be the following. Linux uses periodic SIGPROF signals
> for profiling (Linux doesn't use the profil system call used in other OS's like
> Solaris where the kernel does the profiling on behalf of the process). All
> profile information is collected in the context of the signal handler for the
> SIGPROF signal in Linux. Unfortunately, any thread that's created using
> pthread_create() does not get these periodic SIGPROF signals. Hence any thread
> other than the first thread is not profiled. The fix is to use setitimer()
> system call immediately in the thread startup function for any new thread to
> make the SIGPROF signal to be delivered at the designated interrupt frequency
> (every 10ms). With this fix, the profile produced by gprof reflects the overall
> computation done by all threads in the process. A more general fix would be
> to fix the kernel to make any new threads inherit the setitimer() settings
> for the parent thread.
You have the same problem when doing fork(). Only the parent
will get cpu usage info. I have to call setitimer() too, to make
it work properly.
I complained about it a few days ago, but didn't get a reply yet.
Kurt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-31 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-31 5:31 gprof cannot profile multi-threaded programs Mohit Aron
2001-01-31 14:17 ` Kurt Roeckx [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-01-31 5:38 Dan Kegel
2001-01-31 7:27 ` Mohit Aron
2001-01-31 16:52 ` John Levon
2001-01-31 17:13 ` Dan Kegel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010131151720.A1386@ping.be \
--to=q@ping.be \
--cc=aron@cs.rice.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.