1PROFIL(3) Linux Programmer's Manual PROFIL(3)
2
3
4
6 profil - execution time profile
7
9 #include <unistd.h>
10
11 int profil(unsigned short *buf, size_t bufsiz,
12 size_t offset, unsigned int scale);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 profil():
17 Since glibc 2.21:
18 _DEFAULT_SOURCE
19 In glibc 2.19 and 2.20:
20 _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
21 Up to and including glibc 2.19:
22 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
23
25 This routine provides a means to find out in what areas your program
26 spends most of its time. The argument buf points to bufsiz bytes of
27 core. Every virtual 10 milliseconds, the user's program counter (PC)
28 is examined: offset is subtracted and the result is multiplied by scale
29 and divided by 65536. If the resulting value is less than bufsiz, then
30 the corresponding entry in buf is incremented. If buf is NULL, profil‐
31 ing is disabled.
32
34 Zero is always returned.
35
37 For an explanation of the terms used in this section, see at‐
38 tributes(7).
39
40 ┌──────────┬───────────────┬───────────┐
41 │Interface │ Attribute │ Value │
42 ├──────────┼───────────────┼───────────┤
43 │profil() │ Thread safety │ MT-Unsafe │
44 └──────────┴───────────────┴───────────┘
45
47 Similar to a call in SVr4 (but not POSIX.1).
48
50 profil() cannot be used on a program that also uses ITIMER_PROF inter‐
51 val timers (see setitimer(2)).
52
53 True kernel profiling provides more accurate results.
54
56 gprof(1), sprof(1), setitimer(2), sigaction(2), signal(2)
57
59 This page is part of release 5.10 of the Linux man-pages project. A
60 description of the project, information about reporting bugs, and the
61 latest version of this page, can be found at
62 https://www.kernel.org/doc/man-pages/.
63
64
65
66Linux 2020-12-21 PROFIL(3)