Commit | Line | Data |
---|---|---|
76b79f1f KT |
1 | .th MONITOR III 5/10/73 |
2 | .sh NAME | |
3 | monitor \*- prepare execution profile | |
4 | .sh SYNOPSIS | |
5 | .ft B | |
6 | monitor(lowpc, highpc, buffer, bufsize) | |
7 | .br | |
8 | int lowpc( ), highpc( ), buffer[ ], bufsize; | |
9 | .sh DESCRIPTION | |
10 | .it Monitor | |
11 | is an interface to the system's profile entry (II). | |
12 | .it lowpc | |
13 | and | |
14 | .it highpc | |
15 | are the names of two functions; | |
16 | .it buffer | |
17 | is the address of a (user supplied) | |
18 | array of | |
19 | .it bufsize | |
20 | integers. | |
21 | .it Monitor | |
22 | arranges for the system to sample the user's | |
23 | program counter periodically | |
24 | and record the execution histogram in | |
25 | the buffer. | |
26 | The lowest address sampled | |
27 | is that of | |
28 | .it lowpc | |
29 | and the highest is | |
30 | just below \fIhighpc\fR. | |
31 | For the results to be significant, | |
32 | especially where there are small, heavily | |
33 | used routines, | |
34 | it is suggested that the buffer be no more | |
35 | than a few times smaller than the range | |
36 | of locations sampled. | |
37 | .s3 | |
38 | To profile the entire program, | |
39 | it is sufficient to use | |
40 | .s3 | |
41 | extern etext; | |
42 | ... | |
43 | monitor(2, &etext, buf, bufsize); | |
44 | .s3 | |
45 | .it etext | |
46 | is a loader-defined symbol which lies just above all the | |
47 | program text. | |
48 | .s3 | |
49 | To stop execution monitoring and write the results | |
50 | on the file \fBmon.out\fR. | |
51 | use | |
52 | .s3 | |
53 | monitor(0); | |
54 | .s3 | |
55 | Then, when the program exits, prof (I) can be used | |
56 | to examine the results. | |
57 | .sh FILES | |
58 | mon.out | |
59 | .sh "SEE ALSO" | |
60 | prof (I), profil (II) |