|
|
1.1 root 1: .TH MONITOR 3
2: .CT 2 debug_tune
3: .SH NAME
4: monitor \(mi prepare execution profile
5: .SH SYNOPSIS
6: .nf
7: .B monitor(lowpc, highpc, buffer, bufsize, nfunc)
8: .B int (*lowpc)(), (*highpc)();
9: .B short buffer[];
10: .fi
11: .SH DESCRIPTION
12: An executable program created by
13: .L
14: cc -p
15: automatically includes calls for
16: .I monitor
17: with default parameters;
18: .I monitor
19: needn't be called explicitly
20: except to gain fine control over profiling.
21: .PP
22: .I Monitor
23: is an interface to
24: .IR profil (2).
25: .I Lowpc
26: and
27: .I highpc
28: are the addresses of two functions;
29: .I buffer
30: is the address of a (user supplied)
31: array of
32: .I bufsize
33: bytes.
34: .I Monitor
35: arranges to record a histogram of
36: periodically sampled values of the program counter,
37: and of counts of calls
38: of certain functions, in the buffer.
39: The lowest address sampled
40: is that of
41: .I lowpc
42: and the highest is
43: just below
44: .IR highpc .
45: At most
46: .I nfunc
47: call counts can be kept; only calls of functions
48: compiled with the profiling option
49: .B -p
50: of
51: .IR cc (1)
52: are recorded.
53: For the results to be significant,
54: especially where there are small, heavily
55: used routines,
56: it is suggested that the buffer be no more
57: than a few times smaller than the range
58: of locations sampled.
59: The default values for
60: .I bufsize
61: and
62: .I nfunc
63: are
64: (\f2highpc\fP\-\f2lowpc\fP)/8
65: and 300 respectively.
66: .PP
67: To profile the entire program, use
68: .PP
69: .nf
70: .ft L
71: extern etext();
72: . . .
73: monitor((int (*)())2, etext, buf, bufsize, nfunc);
74: .ft P
75: .fi
76: .PP
77: .I Etext
78: lies just above all the
79: program text, see
80: .IR end (3).
81: For the highest resolution profiling on the VAX, use
82: .B
83: bufsize = ((int)highpc)-((int)lowpc)+12+8*nfunc\fR.
84: .PP
85: To stop execution monitoring and write the results
86: on the file
87: .I mon.out,
88: use
89: .PP
90: .L
91: monitor((int (*)())0);
92: .LP
93: then
94: .IR prof (1)
95: can be used
96: to examine the results.
97: .SH FILES
98: .TP
99: .F mon.out
100: .SH "SEE ALSO"
101: .IR prof (1),
102: .IR profil (2),
103: .IR cc (1)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.