


PROF(3)                C LIBRARY FUNCTIONS                PROF(3)



NAME
     prof - profile within a function

SYNOPSIS
     #define MARK
     #include <prof.h>

     void MARK (name)

DESCRIPTION
     MARK introduces a mark called _n_a_m_e that is treated the  same
     as  a function 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 func-
     tion if there are no preceding marks within the active func-
     tion.

     _n_a_m_e may be any combination of up to six letters, numbers or
     underscores.   Each  _n_a_m_e  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 <prof.h> is included.  This may be
     defined by a preprocessor directive as in the  synopsis,  or
     by a command line argument, such as:

          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.

EXAMPLE
     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 <prof.h>
          func( )
          {
               int i, j;
               .
               .
               .
               MARK (loop1);
               for (i = 0; i < 2000; i++) {
                    . . .
               }
               MARK (loop2);
               for (j = 0; j < 2000; j++) {



Sun Release 4.1    Last change: 6 October 1987                  1






PROF(3)                C LIBRARY FUNCTIONS                PROF(3)



                    . . .
               }
          }

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

















































Sun Release 4.1    Last change: 6 October 1987                  2



