Start development on Research V7
[unix-history] / .ref-Research-V6 / usr / doc / man / man3 / monitor.3
CommitLineData
878b8aef
KT
1.th MONITOR III 2/11/74
2.sh NAME
3monitor \*- prepare execution profile
4.sh SYNOPSIS
5.ft B
6monitor(lowpc, highpc, buffer, bufsize)
7.br
8int lowpc( ), highpc( ), buffer[ ], bufsize;
9.ft R
10.sh DESCRIPTION
11.it Monitor
12is an interface to the system's profile entry (II).
13.it Lowpc
14and
15.it highpc
16are the names of two functions;
17.it buffer
18is the address of a (user supplied)
19array of
20.it bufsize
21integers.
22.it Monitor
23arranges for the system to sample the user's
24program counter periodically
25and record the execution histogram in
26the buffer.
27The lowest address sampled
28is that of
29.it lowpc
30and the highest is
31just below
32.it highpc.
33For the results to be significant,
34especially where there are small, heavily
35used routines,
36it is suggested that the buffer be no more
37than a few times smaller than the range
38of locations sampled.
39.s3
40To profile the entire program,
41it is sufficient to use
42.s3
43 extern etext;
44.br
45 ...
46.br
47 monitor(2, &etext, buf, bufsize);
48.s3
49.it Etext
50is a loader-defined symbol which lies just above all the
51program text.
52.s3
53To stop execution monitoring and write the results
54on the file
55.it mon.out,
56use
57.s3
58 monitor(0);
59.s3
60Then, when the program exits, prof (I) can be used
61to examine the results.
62.s3
63It is seldom necessary to call this routine
64directly; the
65.bd \*-p
66option of
67.it cc
68is simpler if one is satisfied with
69its default profile range and resolution.
70.sh FILES
71mon.out
72.sh "SEE ALSO"
73prof (I), profil (II), cc (I)