This is the mail archive of the glibc-bugs@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/372] New: gprof, ITIMER_PROF


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.


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