]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/profil.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / profil.3
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Modified Fri Jun 23 01:35:19 1995 Andries Brouwer <aeb@cwi.nl>
26 .\" (prompted by Bas V. de Bakker <bas@phys.uva.nl>)
27 .\" Corrected (and moved to man3), 980612, aeb
28 .TH PROFIL 3 2017-09-15 "Linux" "Linux Programmer's Manual"
29 .SH NAME
30 profil \- execution time profile
31 .SH SYNOPSIS
32 .nf
33 .B #include <unistd.h>
34 .PP
35 .BI "int profil(unsigned short *" buf ", size_t " bufsiz ,
36 .BI " size_t " offset ", unsigned int " scale );
37 .PP
38 .fi
39 .in -4n
40 Feature Test Macro Requirements for glibc (see
41 .BR feature_test_macros (7)):
42 .in
43 .PP
44 .BR profil ():
45 .nf
46 Since glibc 2.21:
47 .\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
48 _DEFAULT_SOURCE
49 In glibc 2.19 and 2.20:
50 _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
51 Up to and including glibc 2.19:
52 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
53 .fi
54 .SH DESCRIPTION
55 This routine provides a means to find out in what areas your program
56 spends most of its time.
57 The argument
58 .I buf
59 points to
60 .I bufsiz
61 bytes of core.
62 Every virtual 10 milliseconds, the user's program counter (PC)
63 is examined:
64 .I offset
65 is subtracted and the result is multiplied by
66 .I scale
67 and divided by 65536.
68 If the resulting value is less than
69 .IR bufsiz ,
70 then the corresponding entry in
71 .I buf
72 is incremented.
73 If
74 .I buf
75 is NULL, profiling is disabled.
76 .SH RETURN VALUE
77 Zero is always returned.
78 .SH ATTRIBUTES
79 For an explanation of the terms used in this section, see
80 .BR attributes (7).
81 .TS
82 allbox;
83 lb lb lb
84 l l l.
85 Interface Attribute Value
86 T{
87 .BR profil ()
88 T} Thread safety MT-Unsafe
89 .TE
90 .sp 1
91 .SH CONFORMING TO
92 Similar to a call in SVr4 (but not POSIX.1).
93 .SH BUGS
94 .BR profil ()
95 cannot be used on a program that also uses
96 .B ITIMER_PROF
97 interval timers (see
98 .BR setitimer (2)).
99 .PP
100 True kernel profiling provides more accurate results.
101 Libc 4.4 contained a kernel patch providing a system call profil.
102 .SH SEE ALSO
103 .BR gprof (1),
104 .BR sprof (1),
105 .BR setitimer (2),
106 .BR sigaction (2),
107 .BR signal (2)