public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/372] New: gprof, ITIMER_PROF
@ 2004-09-08 13:15 kris dot demuynck at esat dot kuleuven dot ac dot be
  2005-09-22 18:44 ` [Bug libc/372] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: kris dot demuynck at esat dot kuleuven dot ac dot be @ 2004-09-08 13:15 UTC (permalink / raw)
  To: glibc-bugs

With my current installation of linux/gcc/libc (specifications, see below),
gprof does no longer function correctly.
In the best case, gprof reports the actual timings x10. The reason seems to be
that the ITIMER_PROF interval timer is set to 999usec instead of 9999usec.
Note: Since the system clock/timer also went from 100Hz to 1000Hz, these two
timers may be correlated.

The main problem is not the factor 10 (my math is still that good), but the
overflow of the 16 bit counters gprof uses to derive it statistics. If a
program contains a single hot-spot, the counter may overflow from the moment
the program takes longer than 65536*1msec = 1min 5sec. This renders gprof
useless for all but the simplest programs.

Changing the precision of the counters may be difficult; see quote below from
Jim Wilson (I first sent a bug-report to gcc since I assumed the ITIMER_PROF was
set in gcrt1.o, but gcrt1.o only calls __monstartup() in glibc).
> This stems from a limitation of the profil() system call, which requires an
> unsigned short * parameter.  Thus fixing this means a kernel change (and
> perhaps a new system call to avoid breaking standards conformance), a glibc
> change, and a binutils change.  No gcc changes should be needed.  This will
> probably be difficult to coordinate and accomplish.

The easiest solution probably is to set the ITIMER_PROF to 9999 usec,
irrespective of the system clock (this provided reasonable results in my tests).

Details of the system used:
  gcc:    3.4.1
  kernel: 2.6.7-1.494.2.2smp
  libc:   GNU C Library stable release version 2.3.3
  gprof:  GNU gprof 2.15.90.0.3

-- 
           Summary: gprof, ITIMER_PROF
           Product: glibc
           Version: 2.3.3
            Status: NEW
          Severity: minor
          Priority: P3
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: kris dot demuynck at esat dot kuleuven dot ac dot be
                CC: glibc-bugs at sources dot redhat dot com


http://sources.redhat.com/bugzilla/show_bug.cgi?id=372

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libc/372] gprof, ITIMER_PROF
  2004-09-08 13:15 [Bug libc/372] New: gprof, ITIMER_PROF kris dot demuynck at esat dot kuleuven dot ac dot be
@ 2005-09-22 18:44 ` drepper at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drepper at redhat dot com @ 2005-09-22 18:44 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2005-09-22 18:44 -------
Overflows are a fact of life when it comes to gprof.  You want a fixed, high
interval, others want high precision.  If you want to avoid overflows, use a
lower HZ value.  Or even better: use a sane profiling method.  There is nothing
which can be done with gprof without breaking binary and tools compatibility.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://sourceware.org/bugzilla/show_bug.cgi?id=372

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-22 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-08 13:15 [Bug libc/372] New: gprof, ITIMER_PROF kris dot demuynck at esat dot kuleuven dot ac dot be
2005-09-22 18:44 ` [Bug libc/372] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).