1prof(5)               Standards, Environments, and Macros              prof(5)
2
3
4

NAME

6       prof - profile within a function
7

SYNOPSIS

9       #define MARK
10       #include <prof.h>
11
12       void MARK(name);
13
14

DESCRIPTION

16       MARK introduces a mark called  name that is treated the same as a func‐
17       tion entry point.  Execution of the mark adds to  a  counter  for  that
18       mark,  and  program-counter  time spent is accounted to the immediately
19       preceding mark or to the function  if  there  are  no  preceding  marks
20       within the active function.
21
22
23       name  may be any combination of letters, numbers, or  underscores. Each
24       name in a single compilation must be unique, but may be the same as any
25       ordinary program symbol.
26
27
28       For  marks  to be effective, the symbol MARK must be defined before the
29       header  prof.h is included, either by a  preprocessor directive  as  in
30       the synopsis, or by a command line argument:
31
32
33       cc -p -DMARK work.c
34
35
36       If  MARK  is not defined, the  MARK(name) statements may be left in the
37       source files  containing them and are ignored. prof -g must be used  to
38       get information on all labels.
39

EXAMPLES

41       In  this example, marks can be used to determine how much time is spent
42       in each loop. Unless this example is compiled with  MARK defined on the
43       command line, the marks are ignored.
44
45         #include <prof.h>
46         work( )
47         {
48                 int i, j;
49                 . . .
50                 MARK(loop1);
51                 for (i = 0; i < 2000; i++) {
52                         . . .
53                 }
54                 MARK(loop2);
55                 for (j = 0; j < 2000; j++) {
56                         . . .
57                 }
58         }
59
60

SEE ALSO

62       profil(2), monitor(3C)
63
64
65
66SunOS 5.11                        3 Jul 1990                           prof(5)
Impressum