OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man3 / profil.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
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 .B #include <unistd.h>
33 .sp
34 .BI "int profil(unsigned short *" buf ", size_t " bufsiz \
35 ", size_t " offset ", unsigned int " scale );
36 .sp
37 .in -4n
38 Feature Test Macro Requirements for glibc (see
39 .BR feature_test_macros (7)):
40 .in
41 .sp
42 .BR profil ():
43 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
44 .SH DESCRIPTION
45 This routine provides a means to find out in what areas your program
46 spends most of its time.
47 The argument
48 .I buf
49 points to
50 .I bufsiz
51 bytes of core.
52 Every virtual 10 milliseconds, the user's program counter (PC)
53 is examined:
54 .I offset
55 is subtracted and the result is multiplied by
56 .I scale
57 and divided by 65536.
58 If the resulting value is less than
59 .IR bufsiz ,
60 then the corresponding entry in
61 .I buf
62 is incremented.
63 If
64 .I buf
65 is NULL, profiling is disabled.
66 .SH "RETURN VALUE"
67 Zero is always returned.
68 .SH "CONFORMING TO"
69 Similar to a call in SVr4 (but not POSIX.1-2001).
70 .SH BUGS
71 .BR profil ()
72 cannot be used on a program that also uses
73 .B ITIMER_PROF
74 interval timers (see
75 .BR setitimer (2)).
76
77 True kernel profiling provides more accurate results.
78 Libc 4.4 contained a kernel patch providing a system call profil.
79 .SH "SEE ALSO"
80 .BR gprof (1),
81 .BR setitimer (2),
82 .BR sigaction (2),
83 .BR signal (2)