Debian Codegraph @

upstream/debian-trixie/man3/profil.3

raw
1 '\" t
2 .\" Copyright 1993 Rickard E. Faith ([email protected])
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" Modified Fri Jun 23 01:35:19 1995 Andries Brouwer <[email protected]>
7 .\" (prompted by Bas V. de Bakker <[email protected]>)
8 .\" Corrected (and moved to man3), 980612, aeb
9 .TH profil 3 2024-05-02 "Linux man-pages 6.9.1"
10 .SH NAME
11 profil \- execution time profile
12 .SH LIBRARY
13 Standard C library
14 .RI ( libc ", " \-lc )
15 .SH SYNOPSIS
16 .nf
17 .B #include <unistd.h>
18 .P
19 .BI "int profil(unsigned short *" buf ", size_t " bufsiz ,
20 .BI " size_t " offset ", unsigned int " scale );
21 .P
22 .fi
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .P
28 .BR profil ():
29 .nf
30 Since glibc 2.21:
31 .\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
32 _DEFAULT_SOURCE
33 In glibc 2.19 and 2.20:
34 _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
35 Up to and including glibc 2.19:
36 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
37 .fi
38 .SH DESCRIPTION
39 This routine provides a means to find out in what areas your program
40 spends most of its time.
41 The argument
42 .I buf
43 points to
44 .I bufsiz
45 bytes of core.
46 Every virtual 10 milliseconds, the user's program counter (PC)
47 is examined:
48 .I offset
49 is subtracted and the result is multiplied by
50 .I scale
51 and divided by 65536.
52 If the resulting value is less than
53 .IR bufsiz ,
54 then the corresponding entry in
55 .I buf
56 is incremented.
57 If
58 .I buf
59 is NULL, profiling is disabled.
60 .SH RETURN VALUE
61 Zero is always returned.
62 .SH ATTRIBUTES
63 For an explanation of the terms used in this section, see
64 .BR attributes (7).
65 .TS
66 allbox;
67 lbx lb lb
68 l l l.
69 Interface Attribute Value
70 T{
71 .na
72 .nh
73 .BR profil ()
74 T} Thread safety MT-Unsafe
75 .TE
76 .SH STANDARDS
77 None.
78 .SH HISTORY
79 Similar to a call in SVr4.
80 .SH BUGS
81 .BR profil ()
82 cannot be used on a program that also uses
83 .B ITIMER_PROF
84 interval timers (see
85 .BR setitimer (2)).
86 .P
87 True kernel profiling provides more accurate results.
88 .\" Libc 4.4 contained a kernel patch providing a system call profil.
89 .SH SEE ALSO
90 .BR gprof (1),
91 .BR sprof (1),
92 .BR setitimer (2),
93 .BR sigaction (2),
94 .BR signal (2)