monitor(3C)monitor(3C)NAMEmonitor() - prepare execution profile
An executable program created by automatically includes calls for with
default parameters; need not be called explicitly except to gain fine
control over profiling.
is an interface to profil(2). lowpc and highpc are the addresses of
two functions; buffer is the address of a (user-supplied) array of buf‐
size WORDs (defined in the header file). The address should have
proper alignment to be cast to type and in
arranges to record in the buffer a histogram of periodically sampled
values of the program counter, and of counts of calls of certain func‐
tions. The lowest address sampled is that of lowpc and the highest is
just below highpc. lowpc must not equal 0 for this use of monitor.
Not more than nfunc call counts can be kept; only calls of functions
compiled with the profiling option of are recorded. (The C Library and
Math Library supplied when is used also have call counts recorded.)
For results to be significant, especially where there are small, heav‐
ily used routines, it is suggested that the buffer be no more than a
few times smaller than the range of locations sampled.
To profile the entire program, it is sufficient to use
etext lies just above all the program text (see end(3C)).
To stop execution monitoring and write the results on file use
prof(1) can then be used to examine the results.
FILESSEE ALSOcc_bundled(1), prof(1), profil(2), end(3C).