.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)moncontrol.3 6.1 (Berkeley) %G%
monitor, monstartup, moncontrol \- prepare execution profile
.B monitor(lowpc, highpc, buffer, bufsize, nfunc)
.B int (*lowpc)(), (*highpc)();
.B monstartup(lowpc, highpc)
.B int (*lowpc)(), (*highpc)();
There are two different forms of monitoring available:
An executable program created by:
automatically includes calls for the
monitor and includes an initial call to its start-up routine
need not be called explicitly except to gain fine control over profil
An executable program created by:
automatically includes calls for the
is a high level interface to
specify the address range that is to be sampled; the lowest address sampled
and the highest is just below
(see below) to record a histogram of periodically sampled values of
the program counter, and of counts of calls of certain functions, in the buffer.
Only calls of functions compiled with the profiling option
To profile the entire program, it is sufficient to use
monstartup((int) 2, etext);
lies just above all the program text, see
To stop execution monitoring and write the results on the file
can be used to examine the results.
is used to selectively control profiling within a program.
When the program starts, profiling begins.
To stop the collection of histogram ticks and call counts use
to resume the collection of histogram ticks and call counts use
This allows the cost of particular operations to be measured.
Note that an output file will be produced upon program exit
irregardless of the state of
is a low level interface to
are the addresses of two functions;
is the address of a (user supplied) array of
For the results to be significant, especially where there are small, heavily
used routines, it is suggested that the buffer be no more
than a few times smaller than the range of locations sampled.
divides the buffer into space to record the histogram
of program counter samples over the range
and space to record call counts of functions compiled with the
To profile the entire program, it is sufficient to use
monitor((int) 2, etext, buf, bufsize, nfunc);
cc(1), prof(1), gprof(1), profil(2), sbrk(2)