1profil(3)                  Library Functions Manual                  profil(3)
2
3
4

NAME

6       profil - execution time profile
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <unistd.h>
13
14       int profil(unsigned short *buf, size_t bufsiz,
15                  size_t offset, unsigned int scale);
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       profil():
20           Since glibc 2.21:
21               _DEFAULT_SOURCE
22           In glibc 2.19 and 2.20:
23               _DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
24           Up to and including glibc 2.19:
25               _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
26

DESCRIPTION

28       This  routine  provides  a means to find out in what areas your program
29       spends most of its time.  The argument buf points to  bufsiz  bytes  of
30       core.   Every  virtual 10 milliseconds, the user's program counter (PC)
31       is examined: offset is subtracted and the result is multiplied by scale
32       and divided by 65536.  If the resulting value is less than bufsiz, then
33       the corresponding entry in buf is incremented.  If buf is NULL, profil‐
34       ing is disabled.
35

RETURN VALUE

37       Zero is always returned.
38

ATTRIBUTES

40       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
41       tributes(7).
42
43       ┌──────────────────────────────────────────┬───────────────┬───────────┐
44Interface                                 Attribute     Value     
45       ├──────────────────────────────────────────┼───────────────┼───────────┤
46profil()                                  │ Thread safety │ MT-Unsafe │
47       └──────────────────────────────────────────┴───────────────┴───────────┘
48

STANDARDS

50       None.
51

HISTORY

53       Similar to a call in SVr4.
54

BUGS

56       profil() cannot be used on a program that also uses ITIMER_PROF  inter‐
57       val timers (see setitimer(2)).
58
59       True kernel profiling provides more accurate results.
60

SEE ALSO

62       gprof(1), sprof(1), setitimer(2), sigaction(2), signal(2)
63
64
65
66Linux man-pages 6.04              2023-03-30                         profil(3)
Impressum