Commit Graph

85 Commits

Author SHA1 Message Date
gber
cf4496cb42 Fix resolving symbol names on ARM.
On ARM, binutils are adding '$a' symbols in the symbol table for
every function (in addition to normal symbol). When gprof(1) looks
up symbol name, it often reads '$a' instead of proper function name,
because it find it first. With this fix, when read symbol name
begins with '$' and previous symbol has the same address, it will
use previous symbol name (which is proper function name).

Obtained from:	Semihalf
2012-05-25 06:48:42 +00:00
gjb
c12b44c606 General mdoc(7) and typo fixes.
PR:		167696
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-10 02:07:00 +00:00
dim
7613fb2251 More fixes for correct printf length modifiers usr.bin/gprof.
MFC after:	1 week
2011-12-17 14:51:24 +00:00
dim
3e7d833c6a In usr.bin/gprof/aout.c, use the correct printf length modifier for a
uint32_t.

MFC after:	1 week
2011-12-17 14:37:41 +00:00
joel
29af67e52c 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
uqs
9242c645f8 Move most of the remaining USD/PSD/SMM papers into share/doc 2010-12-04 10:11:20 +00:00
ed
9b380e30d4 Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
ed
2f011fb7c4 Add missing #include for string routines. 2010-01-02 10:12:12 +00:00
obrien
90add981c7 If running with "-K" really do not information about symbols from the a.out
argument.  Before this fix, after searching the currently-running kernel,
we would still search the a.out argument - completely override the in-kernel
list, essentially defeating the K flag's purpose.

PR:		47387
Submitted by:	Ryan Beasley <ryanb@goddamnbastard.org>
2009-01-12 21:49:42 +00:00
trhodes
fb811d854f Remove reference to unimplemented "-c" option.
PR:		119338
2008-12-25 08:48:08 +00:00
obrien
3406a9a37d Add gprof MIPS MD header and enable building gprof.
Obtained from:	Juniper Networks
2008-09-02 15:35:47 +00:00
imp
6ee39a67b3 Add mips support. 2008-04-04 21:33:41 +00:00
ru
aa1113efea Remove alpha-specific stuff. 2006-08-23 12:12:56 +00:00
grehan
c560db5c56 clone i386.h for powerpc 2005-12-29 04:23:54 +00:00
bde
308cbc128c Catch up with increasing the resolution suitable for high-res kernel
profiling from microseconds to nanoseconds in 1996.  Picoseconds are
already needed.

Describe the choice of units for the per-call times in detail.
2005-10-07 11:58:46 +00:00
bde
a5d56eaf9f 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
ru
1541af42f1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
green
481a4ac3e6 Make sure to return 0 from kernel_getnfile() since if there were an
error, it would exit() (and it needs to return a value).
2004-10-05 23:49:27 +00:00
stefanf
d046f2677c Use a proper prototype for hertz(). 2004-10-03 18:22:35 +00:00
stefanf
e0b2a5b339 Fix a few cases that relied on 'implicit int' (constraint violation in C99). 2004-07-11 17:37:33 +00:00
ru
ee5b7e52fa Deal with double whitespace. 2004-07-03 00:24:45 +00:00
ru
002707883c Fix after rev. 1.24 changes: bump document date, and remove -c
from SYNOPSIS.
2004-07-02 22:24:53 +00:00
ru
fb1d8b3724 Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
stefanf
aa456841b2 Retire support for gprof's -c option. All our currently supported
architectures only provide a dummy implementation.

Silence on:	current@
2004-06-20 11:05:25 +00:00
stefanf
4cd22dd0a7 Include <string.h> for prototypes of various string functions.
Approved by:	das (mentor)
2004-05-24 12:44:00 +00:00
stefanf
04f0693a84 Include <netinet/in.h> for ntoh*() and hton*() prototypes.
Approved by:	das (mentor)
2004-05-24 11:59:17 +00:00
peter
1704e84aba Build/install gprof on amd64 as well, after repocopying the MD bits.
Not that it has anything to process yet, but that comes next.
2004-05-18 18:05:19 +00:00
bde
c16e7cdead Fixed total disorder of MD includes.
Disorder buffer overflowed by:	arm commit
2004-05-14 21:05:35 +00:00
cognet
645223694f Some arm bits for gprof. 2004-05-14 13:44:04 +00:00
tjr
f6d56a96f7 Remove MD bits for unsupported architectures. 2003-10-30 12:21:31 +00:00
trhodes
9b883f99f1 Remove 2 more unused doc Makefiles. 2003-02-04 18:26:08 +00:00
grehan
9349f70114 Add powerpc.h. Still missing powerpc.[ch] in gprof, but this gets
the MI stuff out of the way.

Approved: re (rwatson)
2002-12-10 02:22:01 +00:00
ru
14b9c93d91 mdoc(7) police: back out unproved changes in previous revision;
descriptions in the FILES section should be full sentences, as
demonstrated in mdoc(7) and /usr/share/examples/mdoc/.

Approved by:	re
2002-11-26 11:22:59 +00:00
charnier
064bebe6d3 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
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
wollman
0e6b4b2400 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
alfred
f0facdc5dd Check for defined(__i386__) instead of just defined(i386) since the compiler
will be updated to only define(__i386__) for ANSI cleanliness.
2002-05-30 07:00:42 +00:00
charnier
ad8a79e6a5 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
mike
b1d120cfbf Include <stdint.h> for definition of intmax_t and/or uintmax_t. 2002-03-25 05:23:45 +00:00
jake
0517cd92aa Make this build on sparc64. 2002-03-10 01:25:47 +00:00
bde
acab62a802 Support runtime specification of the history counter type by whatever
generated the gmon data.  The support is currently limited to what is
easy to implement and/or needed:

    signedess: signed or insigned
    size: 8, 16, 32 or 64 bits
    format: a binary integer in gprof's format (gprof is not a cross-tool).

High-resolution kernel profiling uses signed 64-bit counters.  Normal
kernel profiling and user profiling use unsigned 16-bit counters but
should use 32-bit ones.
2002-03-06 11:25:58 +00:00
bde
8de8391e81 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
bde
410e57d607 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
bde
2587888af4 Added missing copyright. Obtain one and a vendor id from gprof.c. aout.c
was split off from gprof.c in rev.1.7 of the latter.  elf.c is mostly new,
but the old copyright sort of applies to it and is better than none.

Use __FBSDID() for the FreeBSD id.
2002-02-21 12:03:06 +00:00
bde
a230636d24 Fixed a missing variable declaration so that gprof compiles with -DDEBUG. 2002-02-21 10:34:52 +00:00
bde
118c70fed9 Moved the definition of the machine-independent macro UNITS_TO_CODE
from <number of machines> machine-dependent headers to the one
non-header here it is used so that it is easier to fix.  This macro
just divides the machine-dependent offset OFFSET_OF_CODE by the
machine-independent scale factor sizeof(UNIT), as required for bug
for bug compatibility with the scaling of pc's in gprof.c.  UNIT is
the type of a profiling counter, and its size has nothing to do with
the correct scale factor except both are usually 2.
2002-02-21 07:12:57 +00:00
ru
aa219a0e7b Oops, forgot to remove the `beforeinstall' block. 2001-12-17 16:04:40 +00:00
ru
7ed2dfe749 Install files via FILES. 2001-12-17 16:02:15 +00:00
ru
80a463b623 mdoc(7) police: kill whitespace at EOL. 2001-11-20 15:49:18 +00:00
green
85a9f299f9 Add -K support to gprof(1), which enables dynamic symbol resolution from
the currently-running kernel (and supercedes an executable file argument
given).  With this change, properly-compiled KLD modules are now
able to be profiled.

Obtained from:	NAI Labs CBOSS project
Funded by:	DARPA
2001-10-30 15:54:09 +00:00