This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: gprof & Linux interaction oddity
Mike Frysinger <vapier@gentoo.org> writes:
> > gprof as such doesn't need to know the timing tick. The profiling
> > rate is read out of the gmon.out file written by glibc. glibc appears
> > to compute the rate like this (sysdeps/unix/sysv/linux/prof-freq.c):
>
> well the issue is the gprof/hertz.c file ... it grabs the hertz value as
> reported by glibc via sysconf (which it gets from the kernel) and uses that
> to translate ticks to seconds ... so even though glibc writes out the data
> correctly, gprof reads it in incorrectly ...
As far as I know this is not the case. gprof only uses the hertz()
function in hertz.c for files which do not start with GMON_MAGIC
(i.e., "gmon"). The GMON_MAGIC files includes the tick value; older
formats do not. But glibc generates GMON_MAGIC files, so for them
gprof should not need to get the timing tick. To confirm what I see
in the sources, I ran strace on gprof, and I did not see it call
sysconf.
If you know otherwise, it would help to have more details.
Ian