OSDN Git Service

398bf67ee53cff179278129ca13a7523352a386f
[linuxjm/LDP_man-pages.git] / original / 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 2007-07-26 "Linux" "Linux Programmer's Manual"
29 .SH NAME
30 profil \- execution time profile
31 .SH SYNOPSIS
32 .nf
33 .B #include <unistd.h>
34 .sp
35 .BI "int profil(unsigned short *" buf ", size_t " bufsiz ,
36 .BI "           size_t " offset ", unsigned int " scale );
37 .sp
38 .fi
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)
46 .SH DESCRIPTION
47 This routine provides a means to find out in what areas your program
48 spends most of its time.
49 The argument
50 .I buf
51 points to
52 .I bufsiz
53 bytes of core.
54 Every virtual 10 milliseconds, the user's program counter (PC)
55 is examined:
56 .I offset
57 is subtracted and the result is multiplied by
58 .I scale
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.
68 .SH RETURN VALUE
69 Zero is always returned.
70 .SH CONFORMING TO
71 Similar to a call in SVr4 (but not POSIX.1-2001).
72 .SH BUGS
73 .BR profil ()
74 cannot be used on a program that also uses
75 .B ITIMER_PROF
76 interval timers (see
77 .BR setitimer (2)).
78
79 True kernel profiling provides more accurate results.
80 Libc 4.4 contained a kernel patch providing a system call profil.
81 .SH SEE ALSO
82 .BR gprof (1),
83 .BR setitimer (2),
84 .BR sigaction (2),
85 .BR signal (2)
86 .SH COLOPHON
87 This page is part of release 3.67 of the Linux
88 .I man-pages
89 project.
90 A description of the project,
91 information about reporting bugs,
92 and the latest version of this page,
93 can be found at
94 \%http://www.kernel.org/doc/man\-pages/.