PROFIL(2) — SYSTEM CALLS
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 milliseconds); 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-interrupting 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 memory fault.
RETURN VALUES
profil() always succeeds and returns 0.
SEE ALSO
gprof(1), getitimer(2), monitor(3)
Solbourne Computer, Inc. — 21 January 1990