OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man3 / clock.3
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\" License.
23 .\" Modified Sat Jul 24 21:27:01 1993 by Rik Faith (faith@cs.unc.edu)
24 .\" Modified 14 Jun 2002, Michael Kerrisk <mtk.manpages@gmail.com>
25 .\"     Added notes on differences from other Unix systems with respect to
26 .\"     waited-for children.
27 .\"
28 .\" Japanese Version Copyright (c) 1996 Hiroaki Nagoya
29 .\"         all rights reserved.
30 .\" Tranlated Mon Feb  3 15:35:19 JST 1997
31 .\"         by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
32 .\" Updated Fri Sep 27 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
33 .\" Updated 2007-05-28, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.48
34 .\"
35 .\"WORD: processor time   ¥×¥í¥»¥Ã¥µ»þ´Ö
36 .\"WORD: CPU time         CPU»þ´Ö
37 .\"
38 .TH CLOCK 3  2008-08-28 "GNU" "Linux Programmer's Manual"
39 .\"O .SH NAME
40 .SH Ì¾Á°
41 .\"O clock \- Determine processor time
42 clock \- ¥×¥í¥»¥Ã¥µ»þ´Ö¤Î¼èÆÀ
43 .\"O .SH SYNOPSIS
44 .SH ½ñ¼°
45 .nf
46 .B #include <time.h>
47 .sp
48 .B clock_t clock(void);
49 .fi
50 .\"O .SH DESCRIPTION
51 .SH ÀâÌÀ
52 .\"O The
53 .\"O .BR clock ()
54 .\"O function returns an approximation of processor time used by the program.
55 .BR clock ()
56 ¤Ï¥×¥í¥°¥é¥à¤Î»ÈÍѤ·¤¿¥×¥í¥»¥Ã¥µ»þ´Ö¤Î¶á»÷ÃͤòÊÖ¤¹¡£
57 .\"O .SH "RETURN VALUE"
58 .SH ÊÖ¤êÃÍ
59 .\"O The value returned is the CPU time used so far as a
60 .\"O .IR clock_t ;
61 .\"O to get the number of seconds used, divide by
62 .\"O .BR CLOCKS_PER_SEC .
63 .\"O If the processor time used is not available or its value cannot
64 .\"O be represented, the function returns the value
65 .\"O .IR (clock_t)\ \-1 .
66 ÊÖ¤êÃͤÏ
67 .I clock_t
68 ñ°Ì¤Ç¤Î CPU »þ´Ö¤Ç¤¢¤ë¡£
69 ÉÃñ°Ì¤Ç¤ÎÃͤòÆÀ¤ë¤¿¤á¤Ë¤Ï
70 .B CLOCKS_PER_SEC
71 ¤Ç³ä¤ì¤Ð¤è¤¤¡£
72 »ÈÍѤ·¤¿¥×¥í¥»¥Ã¥µ»þ´Ö¤¬ÆÀ¤é¤ì¤Ê¤¤¾ì¹ç¤ä¡¢¤½¤ÎÃͤòɽ¸½¤Ç¤­¤Ê¤¤¾ì¹ç¡¢
73 ¤³¤Î´Ø¿ô¤Ï
74 .I (clock_t)\ \-1
75 ¤òÊÖ¤¹¡£
76 .\"O .SH "CONFORMING TO"
77 .SH ½àµò
78 .\"O C89, C99, POSIX.1-2001.
79 .\"O POSIX requires that
80 .\"O .B CLOCKS_PER_SEC
81 .\"O  equals 1000000 independent
82 .\"O of the actual resolution.
83 C89, C99, POSIX.1-2001.
84 POSIX ¤Ï¼ÂºÝ¤ÎÀºÅ٤ˤϤè¤é¤º
85 .B CLOCKS_PER_SEC
86 ¤¬ 1000000 ¤Ç¤¢¤ë¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£
87 .\"O .SH NOTES
88 .SH Ãí°Õ
89 .\"O The C standard allows for arbitrary values at the start of the program;
90 .\"O subtract the value returned from a call to
91 .\"O .BR clock ()
92 .\"O at the start of the program to get maximum portability.
93 C ¤Îɸ½àµ¬³Ê¤Ç¤Ï¥×¥í¥°¥é¥à¤Î³«»Ï¤Î»þÅÀ¤Ç¤Ï¤É¤ó¤ÊÃͤ¬Ê֤äƤ­¤Æ¤â
94 ¤«¤Þ¤ï¤Ê¤¤¡£
95 °Ü¿¢À­¤òºÇÂç¸Â³ÎÊݤ¹¤ë¤¿¤á¤Ë¤Ï¡¢¥×¥í¥°¥é¥à¤Î³«»Ï»þ¤Ë
96 .BR clock ()
97 ¤ò¸Æ¤Ó½Ð¤·¤Æ¤½¤ÎÃͤòº¹¤·°ú¤¯¤³¤È¡£
98 .PP
99 .\"O Note that the time can wrap around.
100 .\"O On a 32-bit system where
101 .\"O .B CLOCKS_PER_SEC
102 .\"O equals 1000000 this function will return the same
103 .\"O value approximately every 72 minutes.
104 »þ¹ï¤Ï·å¤¢¤Õ¤ì¤¹¤ë²ÄǽÀ­¤¬¤¢¤ëÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
105 .B CLOCKS_PER_SEC
106 ¤¬ 1000000 ¤Ç¤¢¤ë 32 ¥Ó¥Ã¥È¥·¥¹¥Æ¥à¤Ç¤Ï¡¢
107 ¤³¤Î´Ø¿ô¤ÏÌó 72 Ê¬Ëè¤ËƱ¤¸ÃͤòÊÖ¤¹¤³¤È¤Ë¤Ê¤ë¡£
108 .PP
109 .\"O On several other implementations,
110 .\"O the value returned by
111 .\"O .BR clock ()
112 .\"O also includes the times of any children whose status has been
113 .\"O collected via
114 .\"O .BR wait (2)
115 .\"O (or another wait-type call).
116 ¼ÂÁõ¤Ë¤è¤Ã¤Æ¤Ï¡¢
117 .BR clock ()
118 ¤ÇÊÖ¤µ¤ì¤ëÃͤË
119 .BR wait (2)
120 (¤¢¤ë¤¤¤Ï¤½¤Î¾¤Î wait ¤Î¤è¤¦¤Ê´Ø¿ô) ¤Ç¼ý½¸¤µ¤ì¤¿
121 »Ò¥×¥í¥»¥¹¤Î»þ´Ö¤¬´Þ¤Þ¤ì¤ë¾ì¹ç¤â¤¢¤ë¡£
122 .\"O Linux does not include the times of waited-for children in the
123 .\"O value returned by
124 .\"O .BR clock ().
125 Linux ¤Ç¤Ï¡¢
126 .BR clock ()
127 ¤¬ÊÖ¤¹ÃͤˤϠwait ¤µ¤ì¤¿»Ò¥×¥í¥»¥¹¤Î»þ´Ö¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
128 .\" I have seen this behavior on Irix 6.3, and the OSF/1, HP/UX, and
129 .\" Solaris manual pages say that clock() also does this on those systems.
130 .\" POSIX.1-2001 doesn't explicitly allow this, nor is there an
131 .\" explicit prohibition. -- MTK
132 .\"O The
133 .\"O .BR times (2)
134 .\"O function, which explicitly returns (separate) information about the
135 .\"O caller and its children, may be preferable.
136 .BR times (2)
137 ´Ø¿ô¤Ï¸Æ¤Ó½Ð¤·¸µ¤È¤½¤Î»Ò¥×¥í¥»¥¹¤Ë´Ø¤¹¤ë¾ðÊó¤ò
138 (ÊÌ¡¹¤Ë) ÌÀ¼¨Åª¤ËÊÖ¤¹¤Î¤Ç¡¢¤è¤ê¹¥¤Þ¤·¤¤¤À¤í¤¦¡£
139 .\"O .SH "SEE ALSO"
140 .SH ´ØÏ¢¹àÌÜ
141 .BR clock_gettime (2),
142 .BR getrusage (2),
143 .BR times (2)