BSD 4_3_Tahoe release
[unix-history] / usr / src / man / man2 / profil.2
CommitLineData
c579fd7e
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
95f51977 5.\" @(#)profil.2 6.2 (Berkeley) 5/14/86
c579fd7e 6.\"
95f51977 7.TH PROFIL 2 "May 14, 1986"
c579fd7e
KM
8.UC 4
9.SH NAME
10profil \- execution time profile
11.SH SYNOPSIS
12.nf
13.B profil(buff, bufsiz, offset, scale)
14.B char *buff;
15.B int bufsiz, offset, scale;
16.fi
17.SH DESCRIPTION
18.I Buff
19points to an area of core whose length (in bytes) is given by
20.IR bufsiz .
21After this call, the user's program counter (pc)
8a9565d6 22is examined each clock tick (10 milliseconds);
c579fd7e
KM
23.I offset
24is subtracted from it, and the result multiplied by
25.IR scale .
26If the resulting number corresponds to a word
27inside
28.I buff,
29that word is incremented.
30.PP
31The scale is interpreted as an unsigned,
729abab1
MK
32fixed-point fraction with 16 bits of fraction:
330x10000 gives a 1-1 mapping of pc's to words
c579fd7e
KM
34in
35.I buff;
8a9565d6 360x8000 maps each pair of instruction words
c579fd7e 37together.
c579fd7e
KM
38.PP
39Profiling is turned off by giving a
40.I scale
41of 0 or 1.
42It is rendered
43ineffective by giving a
44.I bufsiz
45of 0.
46Profiling is turned off when an
8a9565d6 47.I execve
c579fd7e
KM
48is executed, but remains on in child and parent both
49after a
50.IR fork .
8a9565d6 51Profiling is turned off if an update in
c579fd7e
KM
52.I buff
53would cause a memory fault.
8a9565d6
KM
54.SH "RETURN VALUE
55A 0, indicating success, is always returned.
c579fd7e 56.SH "SEE ALSO"
8a9565d6 57gprof(1), setitimer(2), monitor(3)