]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
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 | |
5722c835 | 28 | .TH PROFIL 3 2015-07-23 "Linux" "Linux Programmer's Manual" |
fea681da MK |
29 | .SH NAME |
30 | profil \- execution time profile | |
31 | .SH SYNOPSIS | |
9ccfb102 | 32 | .nf |
fea681da MK |
33 | .B #include <unistd.h> |
34 | .sp | |
9ccfb102 MK |
35 | .BI "int profil(unsigned short *" buf ", size_t " bufsiz , |
36 | .BI " size_t " offset ", unsigned int " scale ); | |
cc4615cc | 37 | .sp |
9ccfb102 | 38 | .fi |
cc4615cc MK |
39 | .in -4n |
40 | Feature Test Macro Requirements for glibc (see | |
41 | .BR feature_test_macros (7)): | |
42 | .in | |
43 | .sp | |
44 | .BR profil (): | |
45 | _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) | |
fea681da MK |
46 | .SH DESCRIPTION |
47 | This routine provides a means to find out in what areas your program | |
c13182ef MK |
48 | spends most of its time. |
49 | The argument | |
fea681da MK |
50 | .I buf |
51 | points to | |
52 | .I bufsiz | |
c13182ef MK |
53 | bytes of core. |
54 | Every virtual 10 milliseconds, the user's program counter (PC) | |
fea681da MK |
55 | is examined: |
56 | .I offset | |
57 | is subtracted and the result is multiplied by | |
0daa9e92 | 58 | .I scale |
fea681da MK |
59 | and divided by 65536. |
60 | If the resulting value is less than | |
61 | .IR bufsiz , | |
62 | then the corresponding entry in | |
63 | .I buf | |
64 | is incremented. | |
65 | If | |
66 | .I buf | |
67 | is NULL, profiling is disabled. | |
47297adb | 68 | .SH RETURN VALUE |
fea681da | 69 | Zero is always returned. |
44518c2d ZL |
70 | .SH ATTRIBUTES |
71 | For an explanation of the terms used in this section, see | |
72 | .BR attributes (7). | |
73 | .TS | |
74 | allbox; | |
75 | lb lb lb | |
76 | l l l. | |
77 | Interface Attribute Value | |
78 | T{ | |
79 | .BR profil () | |
80 | T} Thread safety MT-Unsafe | |
81 | .TE | |
82 | ||
47297adb | 83 | .SH CONFORMING TO |
7230317f | 84 | Similar to a call in SVr4 (but not POSIX.1). |
fea681da | 85 | .SH BUGS |
e511ffb6 | 86 | .BR profil () |
fea681da MK |
87 | cannot be used on a program that also uses |
88 | .B ITIMER_PROF | |
65e8e0f5 MK |
89 | interval timers (see |
90 | .BR setitimer (2)). | |
fea681da MK |
91 | |
92 | True kernel profiling provides more accurate results. | |
93 | Libc 4.4 contained a kernel patch providing a system call profil. | |
47297adb | 94 | .SH SEE ALSO |
fea681da | 95 | .BR gprof (1), |
5f97eb3b | 96 | .BR sprof (1), |
fea681da MK |
97 | .BR setitimer (2), |
98 | .BR sigaction (2), | |
99 | .BR signal (2) |