.\" The Regents of the University of California. All rights reserved.
.\" This code is derived from software contributed to Berkeley by
.\" %sccs.include.redist.roff%
.\" @(#)profil.2 8.1 (Berkeley) %G%
.Nd control process profiling
.Fn profil "char *samples" "int size" "int offset" "int scale"
function enables or disables
program counter profiling of the current process.
then at every clock tick,
the kernel updates an appropriate count in the
bytes and is divided into
Each bin counts the number of times the program counter
was in a particular address range in the process
when a clock tick occurred while profiling was enabled.
For a given program counter address,
the number of the corresponding bin is given
.Bd -literal -offset indent
[(pc - offset) / 2] * scale / 65536
parameter is the lowest address at which
the kernel takes program counter samples.
parameter ranges from 1 to 65536 and
can be used to change the span of the bins.
A scale of 65536 maps each bin to 2 bytes of address range;
a scale of 32768 gives 4 bytes, 16384 gives 8 bytes and so on.
Intermediate values provide approximate intermediate ranges.
value of 0 disables profiling.
value is nonzero and the buffer
contains an illegal address,
profiling is terminated and
.Bl -tag -width /usr/lib/gcrt0.o -compact
profiling C run-time startup file
conventional name for profiling output file
The following error may be reported:
contains an invalid address.
.\" wish I knew... probably v7.
This routine should be named
argument should really be a vector of type
The format of the gmon.out file is undocumented.