Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

PROF(3)                    Library Functions Manual                    PROF(3)

       prof - profile within a function

       #define MARK
       #include <&lt;prof.h>&gt;

       void MARK (name)

       MARK  introduces a mark called name that is treated the same as a func-
       tion entry point.  Execution of the mark adds to  a  counter  for  that
       mark,  and  program-counter  time spent is accounted to the immediately
       preceding mark or to the function  if  there  are  no  preceding  marks
       within the active function.

       name  may  be  any  combination of up to six letters, numbers or under-
       scores.  Each name in a single compilation must be unique, but  may  be
       the same as any ordinary program symbol.

       For  marks  to be effective, the symbol MARK must be defined before the
       header file <&lt;prof.h>&gt; is included.  This may be defined by a  preproces-
       sor  directive  as in the synopsis, or by a command line argument, such

              cc -p -DMARK foo.c

       If MARK is not defined, the MARK (name) statements may be left  in  the
       source files containing them and will be ignored.

       In  this example, marks can be used to determine how much time is spent
       in each loop.  Unless this example is compiled with MARK defined on the
       command line, the marks are ignored.

              #include <&lt;prof.h>&gt;
              func( )
                   int i, j;
                   MARK (loop1);
                   for (i = 0; i <&lt; 2000; i++) {
                        . . .
                   MARK (loop2);
                   for (j = 0; j <&lt; 2000; j++) {
                        . . .

       prof(1), profil(2), monitor(3)

                                6 October 1987                         PROF(3)