monitor(3c)
_________________________________________________________________
monitor
prepare execution profile
_________________________________________________________________
SYNTAX
#include <mon.h>
void monitor (lowpc, highpc, buffer, bufsize, nfunc)
int (*lowpc)( ), (*highpc)( );
WORD *buffer;
int bufsize, nfunc;
DESCRIPTION
An executable program created by cc -p automatically includes
calls for monitor with default parameters; monitor needn't be
called explicitly except to gain fine control over profiling.
Monitor 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 bufsize WORDs (defined in the <mon.h> header
file). Monitor arranges to record a histogram of periodically
sampled values of the program counter, and of counts of calls of
certain functions, in the buffer. The lowest address sampled is
that of lowpc and the highest is just below highpc. Lowpc may
not equal 0 for this use of monitor. At most nfunc call counts
can be kept; only calls of functions compiled with the profiling
option -p of cc(1) are recorded.
For the results to be significant, especially where there are
small, heavily used routines, the buffer should be no more than a
few times smaller than the range of locations sampled.
To profile the entire program, it is sufficient to use:
extern etext;
...
monitor ((int (*)())2, etext, buf, bufsize, nfunc);
Etext lies just above all the program text; see end(3C).
To stop execution monitoring and write the results on the file
mon.out, use
monitor ((int (*)())0, 0, 0, 0, 0);
Prof(1) can then be used to examine the results.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
monitor(3c)
FILES
mon.out
/lib/libp/libc.a
/lib/libp/libm.a
SEE ALSO
profil(2), end(3C).
cc(1), prof(1) in the User's Reference for the DG/UX System
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)