xref: /csrg-svn/lib/libc/sys/profil.2 (revision 20041)
Copyright (c) 1980 Regents of the University of California.
All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.

@(#)profil.2 4.1 (Berkeley) 05/09/85

PROFIL 2
C 4
NAME
profil - execution time profile
SYNOPSIS
 profil(buff, bufsiz, offset, scale)  char *buff;  int bufsiz, offset, scale; 
DESCRIPTION
Buff points to an area of core whose length (in bytes) is given by bufsiz . After this call, the user's program counter (pc) is examined each clock tick (60th second); offset is subtracted from it, and the result multiplied by scale . If the resulting number corresponds to a word inside buff, that word is incremented.

The scale is interpreted as an unsigned, fixed-point fraction with binary point at the left: 0177777(8) gives a 1-1 mapping of pc's to words in buff; 077777(8) maps each pair of instruction words together. 02(8) maps all instructions onto the beginning of buff (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 exec is executed, but remains on in child and parent both after a fork . Profiling may be turned off if an update in buff would cause a memory fault.

"SEE ALSO"
monitor(3), prof(1)
"ASSEMBLER (PDP-11)"
(profil = 44.)

sys profil; buff; bufsiz; offset; scale

BUGS
Profiling does not work for interpreters; if a signal were given to a process when its cpu-time clock ticked then profiling interpreters would be possible.