freebsd-dev/usr.bin/gprof
Bruce Evans 0b146898f0 Improve printing of self times in the flat profile for functions that
appear to be never called:

(1) If a function is never called according to its call count but it
    must have been called because its child time is nonzero, then print
    it in the flat profile.  Previously, if its call count was zero
    then we only printed it in the flat profile if its self time was
    nonzero.

(2) If a function has a zero call count but has a nonzero self or child
    time, then print its total self time in the self time per call
    column as a percentage of the total (self + child) time.  It is
    not possible to print the times per call in this case because the
    call count is zero.  Previously, this was handled by leaving both
    per-call columns blank.  The self time is printed in another column
    but there was no way to recover the total time.

(1) partially fixes the case of the "never called" function main() and
prepares for (2) to apply to main() and other functions.  Profiling
of main() was lost in the conversion from a.out to ELF, so main()'s
call count has always been zero for many years; then in the common
case where main() is a tiny function, it gets no profiling ticks, so
main() was completely lost in the flat profile.

(2) improves mainly cases like kernel threads.  Most kernel threads
appear to be never called because they are always started before
userland can run to turn on profiling.  As for main(), the fact that
they are called is not very interesting and their callers are
uninteresting, but their relative self time is interesting since they
are long-running.

Almost always printing percentages in the per-call columns would be
more useful than almost always printing 0.0ms.  0.1ms is now a long
time, so only very large functions take that long per call.  The accuracy
per call can approach 1-10 nsec provided programs are run for about
100000 times as long as is necessary to get this accuracy with high
resolution kernel profiling.
2005-10-07 10:59:41 +00:00
..
PSD.doc Remove 2 more unused doc Makefiles. 2003-02-04 18:26:08 +00:00
alpha.h
amd64.h
aout.c Retire support for gprof's -c option. All our currently supported 2004-06-20 11:05:25 +00:00
arcs.c Retire support for gprof's -c option. All our currently supported 2004-06-20 11:05:25 +00:00
arm.h Some arm bits for gprof. 2004-05-14 13:44:04 +00:00
dfn.c Remove done() which was just exit() so use of warn()/err() can be made. Abort 2002-10-16 13:50:09 +00:00
elf.c Remove done() which was just exit() so use of warn()/err() can be made. Abort 2002-10-16 13:50:09 +00:00
gprof.1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
gprof.c Fix a few cases that relied on 'implicit int' (constraint violation in C99). 2004-07-11 17:37:33 +00:00
gprof.callg
gprof.flat
gprof.h Use a proper prototype for hertz(). 2004-10-03 18:22:35 +00:00
hertz.c Use a proper prototype for hertz(). 2004-10-03 18:22:35 +00:00
i386.h
ia64.h
kernel.c Make sure to return 0 from kernel_getnfile() since if there were an 2004-10-05 23:49:27 +00:00
lookup.c Remove done() which was just exit() so use of warn()/err() can be made. Abort 2002-10-16 13:50:09 +00:00
Makefile Retire support for gprof's -c option. All our currently supported 2004-06-20 11:05:25 +00:00
pathnames.h Remove done() which was just exit() so use of warn()/err() can be made. Abort 2002-10-16 13:50:09 +00:00
printgprof.c Improve printing of self times in the flat profile for functions that 2005-10-07 10:59:41 +00:00
printlist.c Include <string.h> for prototypes of various string functions. 2004-05-24 12:44:00 +00:00
sparc64.h