This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Committed]: Update Gprof manual re thread-safe counting functions
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Tue, 08 Jun 2010 11:38:20 +0100
- Subject: [Committed]: Update Gprof manual re thread-safe counting functions
Hi Guys,
I am applying the patch below to add a note to the Gprof manual that
the call counts and basic block counts are only reliable in a
mutli-threaded program if the counting function is itself thread-safe.
This is an issue because the basic mcount function in glibc is not
thread-safe.
Cheers
Nick
gprof/ChangeLog
2010-06-08 Nick Clifton <nickc@redhat.com>
* gprof.texi (Sampling Error): Note that call counts and basic
block counts are only reliable for multi-threaded applications if the
counting function itself is thread safe.
Index: gprof/gprof.texi
===================================================================
RCS file: /cvs/src/src/gprof/gprof.texi,v
retrieving revision 1.31
diff -c -3 -p -r1.31 gprof.texi
*** gprof/gprof.texi 8 Jun 2010 10:30:55 -0000 1.31
--- gprof/gprof.texi 8 Jun 2010 10:36:18 -0000
*************** only a small amount of time, so that on
*** 1615,1624 ****
ought to catch that function in the act only once, there is a pretty good
chance it will actually find that function zero times, or twice.
! By contrast, the number-of-calls and basic-block figures
! are derived by counting, not
! sampling. They are completely accurate and will not vary from run to run
! if your program is deterministic.
The @dfn{sampling period} that is printed at the beginning of the flat
profile says how often samples are taken. The rule of thumb is that a
--- 1615,1628 ----
ought to catch that function in the act only once, there is a pretty good
chance it will actually find that function zero times, or twice.
! By contrast, the number-of-calls and basic-block figures are derived
! by counting, not sampling. They are completely accurate and will not
! vary from run to run if your program is deterministic and single
! threaded. In multi-threaded applications, or single threaded
! applications that link with multi-threaded libraries, the counts are
! only deterministic if the counting function is thread-safe. (Note:
! beware that the mcount counting function in glibc is @emph{not}
! thread-safe). @xref{Implementation, ,Implementation of Profiling}.
The @dfn{sampling period} that is printed at the beginning of the flat
profile says how often samples are taken. The rule of thumb is that a