Commit | Line | Data |
---|---|---|
878b8aef KT |
1 | .th MONITOR III 2/11/74 |
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 | .ft R | |
10 | .sh DESCRIPTION | |
11 | .it Monitor | |
12 | is an interface to the system's profile entry (II). | |
13 | .it Lowpc | |
14 | and | |
15 | .it highpc | |
16 | are the names of two functions; | |
17 | .it buffer | |
18 | is the address of a (user supplied) | |
19 | array of | |
20 | .it bufsize | |
21 | integers. | |
22 | .it Monitor | |
23 | arranges for the system to sample the user's | |
24 | program counter periodically | |
25 | and record the execution histogram in | |
26 | the buffer. | |
27 | The lowest address sampled | |
28 | is that of | |
29 | .it lowpc | |
30 | and the highest is | |
31 | just below | |
32 | .it highpc. | |
33 | For the results to be significant, | |
34 | especially where there are small, heavily | |
35 | used routines, | |
36 | it is suggested that the buffer be no more | |
37 | than a few times smaller than the range | |
38 | of locations sampled. | |
39 | .s3 | |
40 | To profile the entire program, | |
41 | it 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 | |
50 | is a loader-defined symbol which lies just above all the | |
51 | program text. | |
52 | .s3 | |
53 | To stop execution monitoring and write the results | |
54 | on the file | |
55 | .it mon.out, | |
56 | use | |
57 | .s3 | |
58 | monitor(0); | |
59 | .s3 | |
60 | Then, when the program exits, prof (I) can be used | |
61 | to examine the results. | |
62 | .s3 | |
63 | It is seldom necessary to call this routine | |
64 | directly; the | |
65 | .bd \*-p | |
66 | option of | |
67 | .it cc | |
68 | is simpler if one is satisfied with | |
69 | its default profile range and resolution. | |
70 | .sh FILES | |
71 | mon.out | |
72 | .sh "SEE ALSO" | |
73 | prof (I), profil (II), cc (I) |