OSDN Git Service

(split) LDP: Translation snapshots for ja.po.
[linuxjm/LDP_man-pages.git] / draft / man2 / getrusage.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt, March 28, 1992
4 .\" and Copyright (c) 2002 Michael Kerrisk
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" 2004-11-16 -- mtk: the getrlimit.2 page, which formerly included
27 .\" coverage of getrusage(2), has been split, so that the latter is
28 .\" now covered in its own getrusage.2.  For older details of change
29 .\" history, etc., see getrlimit.2
30 .\"
31 .\" Modified 2004-11-16, mtk, Noted that the nonconformance
32 .\"     when SIGCHLD is being ignored is fixed in 2.6.9.
33 .\" 2008-02-22, Sripathi Kodi <sripathik@in.ibm.com>: Document RUSAGE_THREAD
34 .\" 2008-05-25, mtk, clarify RUSAGE_CHILDREN + other clean-ups.
35 .\"
36 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
37 .\"         all rights reserved.
38 .\" Translated 1997-02-22, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
39 .\" Updated and Modified 2001-06-02, Yuichi SATO <ysato444@yahoo.co.jp>
40 .\" Updated and Modified 2001-08-18, Yuichi SATO
41 .\" Updated and Modified 2002-08-25, Yuichi SATO
42 .\" Updated and Modified 2004-01-17, Yuichi SATO
43 .\" Updated and Modified 2004-12-30, Yuichi SATO
44 .\" Updated and Modified 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2008-11-10, Akihiro MOTOKI, LDP v3.11
46 .\"
47 .TH GETRUSAGE 2 2009-08-25 "Linux" "Linux Programmer's Manual"
48 .\"O .SH NAME
49 .SH 名前
50 .\"O getrusage \- get resource usage
51 getrusage \- 資源の使用量を取得する
52 .\"O .SH SYNOPSIS
53 .SH 書式
54 .B #include <sys/time.h>
55 .br
56 .B #include <sys/resource.h>
57 .sp
58 .BI "int getrusage(int " who ", struct rusage *" usage );
59 .\"O .SH DESCRIPTION
60 .SH 説明
61 .PP
62 .\"O .BR getrusage ()
63 .\"O returns resource usage measures for
64 .\"O .IR who ,
65 .\"O which can be one of the following:
66 .BR getrusage ()
67
68 .I who
69 の資源 (resource) の使用量を返す。
70 .I who
71 には以下のいずれか一つを指定できる。
72 .TP
73 .B RUSAGE_SELF
74 .\"O Return resource usage statistics for the calling process,
75 .\"O which is the sum of resources used by all threads in the process.
76 呼び出したプロセスの資源使用量、
77 そのプロセス内の全スレッドが使用している資源の合計を返す。
78
79 前者は呼び出したプロセスのリソース使用量を要求し、
80 後者は呼び出したプロセスの子供のうち
81 終了して待ち状態にあるプロセスの使用量を要求する。
82 .TP
83 .B RUSAGE_CHILDREN
84 .\"O Return resource usage statistics for all children of the
85 .\"O calling process that have terminated and been waited for.
86 .\"O These statistics will include the resources used by grandchildren,
87 .\"O and further removed descendants,
88 .\"O if all of the intervening descendants waited on their terminated children.
89 .\"Omotoki: 訳に自信なし (特に if all of .... 以降が今いち理解できず)
90 呼び出したプロセスの子プロセスのうち、
91 終了して待ち状態にある全プロセスが使用している資源使用量の統計を返す。
92 これらの統計情報には、孫プロセスやその子孫のプロセスのうち、
93 削除待ちのものが使用している資源も含まれる。
94 .TP
95 .\"O .BR RUSAGE_THREAD " (since Linux 2.6.26)"
96 .BR RUSAGE_THREAD " (Linux 2.6.26 以降)"
97 .\"O Return resource usage statistics for the calling thread.
98 呼び出したスレッドに関する資源使用量の統計を返す。
99 .PP
100 .\"O The resource usages are returned in the structure pointed to by
101 .\"O .IR usage ,
102 .\"O which has the following form:
103 資源使用量は
104 .I usage
105 が指す構造体に格納されて返される。
106 構造体は以下の形式である。
107 .PP
108 .in +4n
109 .nf
110 struct rusage {
111 .\"O     struct timeval ru_utime; /* user time used */
112 .\"O     struct timeval ru_stime; /* system time used */
113 .\"O     long   ru_maxrss;        /* maximum resident set size */
114 .\"O     long   ru_ixrss;         /* integral shared memory size */
115 .\"O     long   ru_idrss;         /* integral unshared data size */
116 .\"O     long   ru_isrss;         /* integral unshared stack size */
117 .\"O     long   ru_minflt;        /* page reclaims */
118 .\"O     long   ru_majflt;        /* page faults */
119 .\"O     long   ru_nswap;         /* swaps */
120 .\"O     long   ru_inblock;       /* block input operations */
121 .\"O     long   ru_oublock;       /* block output operations */
122 .\"O     long   ru_msgsnd;        /* messages sent */
123 .\"O     long   ru_msgrcv;        /* messages received */
124 .\"O     long   ru_nsignals;      /* signals received */
125 .\"O     long   ru_nvcsw;         /* voluntary context switches */
126 .\"O     long   ru_nivcsw;        /* involuntary context switches */
127     struct timeval ru_utime; /* 使用されたユーザー時間 */
128     struct timeval ru_stime; /* 使用されたシステム時間 */
129     long   ru_maxrss;        /* RAM 上に存在する仮想ページのサイズ
130                                (resident set size) の最大値 */
131     long   ru_ixrss;         /* 共有メモリの合計サイズ */
132     long   ru_idrss;         /* 非共有データの合計サイズ */
133     long   ru_isrss;         /* 非共有スタックの合計サイズ */
134     long   ru_minflt;        /* 利用されたページ */
135     long   ru_majflt;        /* ページフォールト */
136     long   ru_nswap;         /* スワップ */
137     long   ru_inblock;       /* ブロック入力操作 */
138     long   ru_oublock;       /* ブロック出力操作 */
139     long   ru_msgsnd;        /* 送信されたメッセージ */
140     long   ru_msgrcv;        /* 受信されたメッセージ */
141     long   ru_nsignals;      /* 受信されたシグナル */
142     long   ru_nvcsw;         /* 意図したコンテキスト切り替え */
143     long   ru_nivcsw;        /* 意図しないコンテキスト切り替え */
144 };
145 .fi
146 .in
147 .\"O .SH "RETURN VALUE"
148 .SH 返り値
149 .\"O On success, zero is returned.
150 .\"O On error, \-1 is returned, and
151 .\"O .I errno
152 .\"O is set appropriately.
153 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
154 .I errno
155 に適切な値が設定される。
156 .\"O .SH ERRORS
157 .SH エラー
158 .TP
159 .B EFAULT
160 .\"O .I usage
161 .\"O points outside the accessible address space.
162 .I usage
163 がアクセス可能なアドレス空間の外を指している。
164 .TP
165 .B EINVAL
166 .\"O .I who
167 .\"O is invalid.
168 .I who
169 が無効である。
170 .\"O .SH "CONFORMING TO"
171 .SH 準拠
172 SVr4, 4.3BSD.
173 .\"O POSIX.1-2001 specifies
174 .\"O .BR getrusage (),
175 .\"O but only specifies the fields
176 .\"O .I ru_utime
177 .\"O and
178 .\"O .IR ru_stime .
179 POSIX.1-2001 は
180 .BR getrusage ()
181 を規定しているが、規定しているフィールドは
182 .I ru_utime
183
184 .I ru_stime
185 だけである。
186
187 .\"O .B RUSAGE_THREAD
188 .\"O is Linux-specific.
189 .B RUSAGE_THREAD
190 は Linux 固有である。
191 .\"O .SH NOTES
192 .SH 注意
193 .\"O Resource usage metrics are preserved across an
194 .\"O .BR execve (2).
195 .BR execve (2)
196 の前後でリソース使用量の指標は保持される。
197
198 .\"O Including
199 .\"O .I <sys/time.h>
200 .\"O is not required these days, but increases portability.
201 .\"O (Indeed,
202 .\"O .I struct timeval
203 .\"O is defined in
204 .\"O .IR <sys/time.h> .)
205 今日では
206 .I <sys/time.h>
207 をインクルードする必要はないが、
208 インクルードしておけば移植性が増す。
209 (実際
210 .I struct timeval
211
212 .I <sys/time.h>
213 で定義されている。)
214 .PP
215 .\"O In Linux kernel versions before 2.6.9, if the disposition of
216 .\"O .B SIGCHLD
217 .\"O is set to
218 .\"O .B SIG_IGN
219 .\"O then the resource usages of child processes
220 .\"O are automatically included in the value returned by
221 .\"O .BR RUSAGE_CHILDREN ,
222 .\"O although POSIX.1-2001 explicitly prohibits this.
223 2.6.9 より前のバージョンの Linux カーネルでは、
224 .B SIGCHLD
225 の処理が
226 .B SIG_IGN
227 に設定されていると、
228 子プロセスのリソース使用量が
229 .B RUSAGE_CHILDREN
230 で返される値に自動的に含められる。
231 しかし POSIX.1-2001 では、これを明確に禁止している。
232 .\"O This nonconformance is rectified in Linux 2.6.9 and later.
233 .\"O .\" See the description of getrusage() in XSH.
234 .\"O .\" A similar statement was also in SUSv2.
235 この準拠していなかった点は、Linux 2.6.9 以降で改正された。
236 .\" XSH の getrusage() の説明を参照すること。
237 .\" 同様の記述は SUSv2 にもある。
238 .LP
239 .\"O The structure definition shown at the start of this page
240 .\"O was taken from 4.3BSD Reno.
241 .\"O Not all fields are meaningful under Linux.
242 .\"O In Linux 2.4 only the fields
243 .\"O .IR ru_utime ,
244 .\"O .IR ru_stime ,
245 .\"O .IR ru_minflt ,
246 .\"O and
247 .\"O .I ru_majflt
248 .\"O are maintained.
249 このページの最初で示した構造体の定義は 4.3BSD Reno のものを採用した。
250 Linux では全てのフィールドが意味を持つというわけではない。
251 Linux 2.4 では、フィールド
252 .IR ru_utime ,
253 .IR ru_stime ,
254 .IR ru_minflt ,
255 .I ru_majflt
256 のみがメンテナンスされている。
257 .\"O Since Linux 2.6,
258 .\"O .I ru_nvcsw
259 .\"O and
260 .\"O .I ru_nivcsw
261 .\"O are also maintained.
262 Linux 2.6 以降では
263 .IR ru_nvcsw ,
264 .I ru_nivcsw
265 もメンテナンスされている。
266 .\"O Since Linux 2.6.22,
267 .\"O .I ru_inblock
268 .\"O and
269 .\"O .I ru_oublock
270 .\"O are also maintained.
271 Linux 2.6.22 以降では
272 .IR ru_inblock ,
273 .I ru_oublock
274 もメンテナンスされている。
275
276 .\"O See also the description of
277 .\"O .IR /proc/PID/stat
278 .\"O in
279 .\"O .BR proc (5).
280 .BR proc (5)
281 にある
282 .I /proc/PID/stat
283 の説明も参照のこと。
284 .\"O .SH "SEE ALSO"
285 .SH 関連項目
286 .BR clock_gettime (2),
287 .BR getrlimit (2),
288 .BR times (2),
289 .BR wait (2),
290 .BR wait4 (2),
291 .BR clock (3)