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