Commit Graph

15 Commits

Author SHA1 Message Date
Philippe Charnier
af2637db52 rework old-style functions prototypes
reduce WARNS=6 output
2013-02-14 08:16:03 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
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
Stefan Farfeleder
8b061e144e Include <string.h> for prototypes of various string functions.
Approved by:	das (mentor)
2004-05-24 12:44:00 +00:00
Philippe Charnier
97fa9b7739 Remove done() which was just exit() so use of warn()/err() can be made. Abort
on allocation failure instead of displaying a warning and deferencing NULL
pointer after. Spelling. Add prototypes. Add list of option in synopsis section
of man page, -d is not referenced because available as a compile option. It
should be made a runtime option btw.
2002-10-16 13:50:09 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Garrett Wollman
0fb7a0beb0 Fix preprocessor directive syntax (text after #endif).
The style of this program is still atrocious (not fixed).
2002-05-30 21:18:01 +00:00
Bruce Evans
8109a9af1f Fixed some misspellings of 2 as sizeof(UNIT) so that they won't break
things when sizeof(UNIT) becomes a runtime parameter.  The relevant 2
is the one in profil(2)'s scaling of pc's to bucket numbers:

	   bucket = (pc - offset) / 2 * profil_scale / 65536

gprof(1) must duplicate this scaling, bug for bug compatibly, so it
must first do an integer division by 2 although this mainly makes
scales larger than 65536 useless.  sizeof(UNIT) was already wrong in
gprof4, but there were no problems because the fake profil scale is a
multiple of 2.

There are also some rounding bugs in the scaling, but these are only
problems if profil(2) is used directly to create unusual (and not
useful) scales.
2002-03-06 09:47:36 +00:00
Bruce Evans
8d57b8d3d2 Fixed printf format errors. In printgprof.c, also convert the scale
without possibly losing lots of precision, and print the scale using
%g instead of %d in case it is non-integral.  %g might not be the best
format for this.
2002-02-21 12:07:21 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Philippe Charnier
b34f7debd8 Use err(3). 1997-07-10 06:45:02 +00:00
Bruce Evans
d4aa237228 Print times/call in ns if hz >= 10e7. hz will be this large for high
resolution profiling on Pentiums.  On a 100MHz Pentium, the resolution
is at best 10 ns and actually a few hundred ns, but units of 10's or
100's of ns would be inconvenient and the current units of 1 us are a
bit too coarse.
1996-06-08 12:29:57 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Bruce Evans
ff18d3781d New flag -u to suppress functions whose name does not begin with an
underscore.  Use it to avoid seeing badsw when profiling the kernel.

Print times more accurately (e.g. usec in %8.0f format instead of
msec in %8.2f format for averages) if hz >= 10000.  This should have
no effect now since profhz is only 1024.
1994-09-05 16:14:54 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00