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.
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.
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.
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.
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.
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
longer includes machine/elf.h.
* consumers of elf.h now use the minimalist elf header possible.
This change is motivated by Binutils 2.11.0 and too much clashing over
our base elf headers and the Binutils elf headers.
track.
The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;
.\" $Id$
.\"
If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.
Approved by: bde
EGCS assign weak symbols to inline functions it couldn't inline (e.g. virtual
inline functions), template functions, etc. Omitting them result in quite bogus
profile.
Weak symbols created by __weak_reference are not really problem.
Caught by: Ilya Segalovich <iseg@comptek.ru>
the executable file, so it will work for both a.out and ELF format
files. I have split the object format specific code into separate
source files. It's cleaner than it was before, but it's still
pretty crufty.
Don't cheat on your make world for this update. A lot of things
have to be rebuilt for it to work, including the compiler and all
of the profiled libraries.
special functions have names containing dollar signs, and ignoring
them causes gprof to produce incorrect and sometimes bizarre results.
The comment in the original code said that dollar signs were excluded
because they are used in Pascal labels. That's not much of an
issue these days.
for the GPROF4 case. This allows a simpler method to be used for
non-statistical profiling (it allows overhead adjustments to be
subtracted from one counter without harm if that counter goes
negative; otherwise the adjustment would have to be distributed).
32 bit counters were already too small for GPROF4 with a 200MHz
clock. int64_t counters should be used.
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.
looking at a high resolution clock for each of the following events:
function call, function return, interrupt entry, interrupt exit,
and interesting branches. The differences between the times of
these events are added at appropriate places in a ordinary histogram
(as if very fast statistical profiling sampled the pc at those
places) so that ordinary gprof can be used to analyze the times.
gmon.h:
Histogram counters need to be 4 bytes for microsecond resolutions.
They will need to be larger for the 586 clock.
The comments were vax-centric and wrong even on vaxes. Does anyone
disagree?
gprof4.c:
The standard gprof should support counters of all integral sizes
and the size of the counter should be in the gmon header. This
hack will do until then. (Use gprof4 -u to examine the results
of non-statistical profiling.)
config/*:
Non-statistical profiling is configured with `config -pp'.
`config -p' still gives ordinary profiling.
kgmon/*:
Non-statistical profiling is enabled with `kgmon -B'. `kgmon -b'
still enables ordinary profiling (and distables non-statistical
profiling) if non-statistical profiling is configured.
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.