unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

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

PROFIL(2)                     System Calls Manual                    PROFIL(2)



NAME
       profil - execution time profile

SYNOPSIS
       int profil(buf, bufsiz, offset, scale)
       short *buf;
       int bufsiz;
       void (*offset)();
       int scale;

DESCRIPTION
       profil()  enables  run-time  execution profiling, and reserves a buffer
       for maintaining raw profiling statistics.  buf points  to  an  area  of
       core  of  length  bufsiz  (in  bytes).  After the call to profil(), the
       user's program counter (pc) is examined at each  clock  tick  (10  mil-
       liseconds  on  Sun-4 systems, 20 milliseconds on Sun-3 systems); offset
       is subtracted from its value, and the result multiplied by  scale.   If
       the resulting number corresponds to a word within the buffer, that word
       is incremented.

       scale is interpreted as an unsigned, fixed-point fraction  with  binary
       point  at the left: 0xffff gives a 1-to-1 mapping of pc values to words
       in buf; 0x7fff maps each pair of instruction words together.  0x2  maps
       all  instructions onto the beginning of buf (producing a non-interrupt-
       ing core clock).

       Profiling is turned off by giving a scale of 0 or 1.   It  is  rendered
       ineffective  by  giving a bufsiz of 0.  Profiling is turned off when an
       execve() is executed, but remains on in child and parent both  after  a
       fork().  Profiling is turned off if an update in buf would cause a mem-
       ory fault.

RETURN VALUES
       profil() always succeeds and returns 0.

SEE ALSO
       gprof(1), getitimer(2), monitor(3)



                                21 January 1990                      PROFIL(2)