Unleashed v1.4
[unleashed.git] / share / man / man5 / prof.5
blobacb05d041f61b3b98908a7296987f5458adeb5ea
1 '\" te
2 .\"  Copyright 1989 AT&T
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PROF 5 "Jul 3, 1990"
7 .SH NAME
8 prof \- profile within a function
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #define MARK
13 #include <prof.h>
15 \fBvoid\fR \fBMARK\fR(\fB\fR\fIname\fR);
16 .fi
18 .SH DESCRIPTION
19 .sp
20 .LP
21 \fBMARK\fR introduces a mark called  \fIname\fR that is treated the same as a
22 function entry point.  Execution of the mark adds to a counter for that mark,
23 and program-counter time spent is accounted to the immediately preceding mark
24 or to the function if there are no preceding marks within the active function.
25 .sp
26 .LP
27 \fIname\fR may be any combination of letters, numbers, or  underscores. Each
28 \fIname\fR in a single compilation must be unique, but may be the same as any
29 ordinary program symbol.
30 .sp
31 .LP
32 For marks to be effective, the symbol \fBMARK\fR must be defined before the
33 header  \fBprof.h\fR is included, either by a  preprocessor directive as in the
34 synopsis, or by a command line argument:
35 .sp
36 .LP
37 \fBcc -p -DMARK work.c\fR
38 .sp
39 .LP
40 If \fBMARK\fR is not defined, the  \fBMARK(\fR\fIname\fR\fB)\fR statements may
41 be left in the source files  containing them and are ignored. \fBprof -g\fR
42 must be used to get information on all labels.
43 .SH EXAMPLES
44 .sp
45 .LP
46 In this example, marks can be used to determine how much time is spent in each
47 loop. Unless this example is compiled with  \fBMARK\fR defined on the command
48 line, the marks are ignored.
49 .sp
50 .in +2
51 .nf
52 #include <prof.h>
53 work( )
55         int i, j;
56         ...
57         MARK(loop1);
58         for (i = 0; i < 2000; i++) {
59                 ...
60         }
61         MARK(loop2);
62         for (j = 0; j < 2000; j++) {
63                 ...
64         }
66 .fi
67 .in -2
69 .SH SEE ALSO
70 .sp
71 .LP
72 \fBprofil\fR(2), \fBmonitor\fR(3C)