OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / GNU_binutils / draft / man1 / gprof.1
1 .\" Copyright (c) 1983, 1990 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms are permitted provided
5 .\" that: (1) source distributions retain this entire copyright notice and
6 .\" comment, and (2) distributions including binaries display the following
7 .\" acknowledgement:  ``This product includes software developed by the
8 .\" University of California, Berkeley and its contributors'' in the
9 .\" documentation or other materials provided with the distribution and in
10 .\" all advertising materials mentioning features or use of this software.
11 .\" Neither the name of the University nor the names of its contributors may
12 .\" be used to endorse or promote products derived from this software without
13 .\" specific prior written permission.
14 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 .\"
18 .\"     @(#)gprof.1     6.6 (Berkeley) 7/24/90
19 .\"
20 .\" Japanese Version Copyright (c) 1997-2000 NAKANO Takeo all rights reserved.
21 .\" Translated Fri Jan 9 1998 by NAKANO Takeo <nakano@@apm.seikei.ac.jp>
22 .\" Updated Fri 27 Oct 2000 by NAKANO Takeo
23 .\"
24 .TH GPROF 1 "January 29, 1993"
25 .\"O .SH NAME
26 .\"O gprof \- display call graph profile data
27 .SH 名前
28 gprof \- コール・グラフ (call graph) のプロファイルを表示する
29 .\"O .SH SYNOPSIS
30 .SH 書式
31 .B gprof [ \-abcsz ] [ \-e|\-E
32 .I name
33 .B ] [ \-f|\-F 
34 .I name
35 .B ] 
36 .B [ \-k
37 .I fromname toname
38 .B ] [ 
39 .I objfile
40 .B [ 
41 .I gmon.out
42 .B ] 
43 .B ] 
44 .\"O .SH DESCRIPTION
45 .SH 説明
46 .\"O .B gprof
47 .\"O produces an execution profile of C, Pascal, or Fortran77 programs.
48 .\"O The effect of called routines is incorporated in the profile of each caller.
49 .\"O The profile data is taken from the call graph profile file
50 .\"O \&(`gmon.out' default) which is created by programs
51 .\"O that are compiled with the
52 .\"O .B \-pg
53 .\"O option of
54 .\"O .BR cc ( 1 ) ,
55 .\"O .BR pc ( 1 ) ,
56 .\"O and
57 .\"O .BR f77 ( 1 ) .
58 .B gprof
59 は C, Pascal, Fortran77 プログラムの実行プロファイルを生成する。呼び出
60 されたルーチンの値は呼び出し元に取り込まれる。プロファイルのためのデー
61 タはコール・グラフ (call graph: 関数コールの親子関係のグラフ) のプロファ
62 イルデータファイル (デフォルトでは `gmon.out') から取り
63 込まれる。このファイルは
64 .BR cc ( 1 ) 、
65 .BR pc ( 1 ) 、
66 .BR f77 ( 1 )
67
68 .B \-pg
69 オプションを指定してコンパイルされたプログラムによって作成される。
70 .\"O The
71 .\"O .B \-pg
72 .\"O option also links in versions of the library routines
73 .\"O that are compiled for profiling.
74 .\"O .B Gprof
75 .\"O reads the given object file (the default is `a.out')
76 .\"O and establishes the relation between its symbol table
77 .\"O and the call graph profile from `gmon.out'.
78 .\"O If more than one profile file is specified,
79 .\"O the
80 .\"O .B gprof
81 .\"O output shows the sum of the profile information in the given profile files.
82 .B \-pg
83 オプションでは、リンクされるライブラリもプロファイル用にコンパイルされ
84 たものになる。
85 .B gprof
86 は指定されたオブジェクトファイル (デフォルトは `a.out') からシンボ
87 ルテーブルを読み、これと `gmon.out' のコール・グラフ・プロファイルとを
88 関連付ける。
89 複数のプロファイルデータファイルが指定された場合には、
90 .B gprof
91 はそれらのプロファイル情報をすべて合計して表示する。
92 .PP
93 .\"O .B Gprof
94 .\"O calculates the amount of time spent in each routine.
95 .\"O Next, these times are propagated along the edges of the call graph.
96 .\"O Cycles are discovered, and calls into a cycle are made to share the time
97 .\"O of the cycle.
98 .\"O The first listing shows the functions
99 .\"O sorted according to the time they represent
100 .\"O including the time of their call graph descendants.
101 .\"O Below each function entry is shown its (direct) call graph children,
102 .\"O and how their times are propagated to this function.
103 .\"O A similar display above the function shows how this function's time and the
104 .\"O time of its descendants is propagated to its (direct) call graph parents.
105 .B gprof
106 はそれぞれのルーチンによって消費された時間を計算する。次にこれらの時間
107 をコール・グラフの枝に沿って親ルーチンへと伝播させる。プログラムの 
108 サイクル (cycle: 再帰呼び出しの循環) をまとめ、サイクルへのコールを行っ
109 たルーチンは、サイクルで消費した時間を共有するとみなす。最初のリストは
110 関数で、消費時間の順にソートされている。
111 消費時間にはコール・グラフでの子孫の分も含まれる。それぞれの関数エントリ
112 の下には、その関数のコール・グラフでの (直接の) 子と、そこで消費された
113 時間がどのように関数に伝播したかが表示される。同様の表示は関数の上にも
114 表示されており、その関数とそれらの子孫で消費された時間がどのようにコー
115 ル・グラフの (直接の) 親へ伝播するかが示される。
116 .PP
117 .\"O Cycles are also shown, with an entry for the cycle as a whole and
118 .\"O a listing of the members of the cycle and their contributions to the
119 .\"O time and call counts of the cycle.
120 サイクルも表示される。サイクル全体としてのエントリ、そのサイクルに属す
121 るメンバーのリストとそれぞれのメンバーによって消費された時間、その 
122 サイクルの呼び出し回数などが表示される。
123 .PP
124 .\"O Second, a flat profile is given,
125 .\"O similar to that provided by
126 .\"O .BR prof ( 1 )  .
127 .\"O This listing gives the total execution times, the call counts,
128 .\"O the time in milliseconds the call spent in the routine itself, and
129 .\"O the time in milliseconds the call spent in the routine itself including
130 .\"O its descendants.
131 次にフラットプロファイル
132 .RB ( prof (1)
133 の結果と似たもの) が与えられる。このリストでは合計実行時間、呼び出し回
134 数、そのルーチン自身で消費した時間 (ミリ秒単位)、子孫の分も含めて消費
135 した時間 (ミリ秒単位) が表示される。
136 .PP
137 .\"O Finally, an index of the function names is provided.
138 最後に関数名の索引が与えられる。
139 .\"O .SH OPTIONS
140 .SH オプション
141 .\"O The following options are available:
142 以下のオプションが指定できる:
143 .TP
144 .B \-a
145 .\"O suppresses the printing of statically declared functions.
146 .\"O If this option is given, all relevant information about the static function
147 .\"O (e.g., time samples, calls to other functions, calls from other functions)
148 .\"O belongs to the function loaded just before the static function in the
149 .\"O \&`objfile' file.
150 スタティックに宣言された関数を表示しない。このオプションが指定され
151 ると、スタティックな関数に関する全ての情報 (実行時間、他の関数の呼び出
152 し、他の関数から呼び出される関係など) は、ファイル `objfile' 中でこの
153 スタティックな関数の直前にロードされた関数に属することになる。
154 .TP
155 .B \-b
156 .\"O suppresses the printing of a description of each field in the profile.
157 プロファイルのそれぞれのフィールドに関する説明を表示しない。
158 .TP
159 .B \-c
160 .\"O the static call graph of the program is discovered by a heuristic
161 .\"O that examines the text space of the object file.
162 .\"O Static-only parents or children are shown
163 .\"O with call counts of 0.
164 プログラムのスタティックなコール・グラフを、オブジェクトファイルのテキ
165 ストセグメントを調べるという発見的 (heuristic) な手法で作成する。ス
166 タティック・コールだけの親や子の呼び出し回数は 0 として表示する。
167 .TP
168 .BI "\-e " name
169 .\"O suppresses the printing of the graph profile entry for routine
170 .\"O .I name
171 .\"O and all its descendants
172 .\"O (unless they have other ancestors that aren't suppressed).
173 .\"O More than one
174 .\"O .B \-e
175 .\"O option may be given.
176 .\"O Only one
177 .\"O .I name
178 .\"O may be given with each
179 .\"O .B \-e
180 .\"O option.
181 ルーチン
182 .I name
183 と、その子孫すべてに関するグラフプロファイルのエントリを表示しない 
184 (子孫に関しては、別の祖先がいれば表示される)。
185 .B \-e
186 オプションは複数回指定できる。一つの
187 .B \-e
188 オプションについて指定できる
189 .I name
190 は一つだけである。
191 .TP
192 .BI "\-E " name
193 .\"O suppresses the printing of the graph profile entry for routine
194 .\"O .I name
195 .\"O (and its descendants) as
196 .\"O .B \-e  ,
197 .\"O above, and also excludes the time spent in
198 .\"O .I name
199 .\"O (and its descendants) from the total and percentage time computations.
200 .\"O (For example,
201 .\"O .BI "\-E " mcount
202 .\"O .BI "\-E " mcleanup
203 .\"O is the default.)
204 .B \-e
205 と同様にルーチン
206 .I name
207 とその子孫に関するグラフプロファイルのエントリを表示しない。また
208 .I name
209 (とその子孫) によって消費された時間も、プログラム実行の総時間 (および
210 パーセンテージの計算) から除かれる。例えば
211 .BI "\-E " mcount
212 .BI "\-E " mcleanup
213 はデフォルトになっている。
214 .TP
215 .BI "\-f " name
216 .\"O prints the graph profile entry of only the specified routine
217 .\"O .I name
218 .\"O and its descendants.
219 .\"O More than one
220 .\"O .B \-f
221 .\"O option may be given.
222 .\"O Only one
223 .\"O .I name
224 .\"O may be given with each
225 .\"O .B \-f
226 .\"O option.
227 ルーチン
228 .I name
229 とその子孫に関してのみ、グラフプロファイルのエントリを表示する。
230 .B \-f
231 オプションは複数回指定できる。一つの
232 .B \-f
233 オプションについて指定できる
234 .I name
235 は一つだけである。
236 .TP
237 .BI "\-F " name
238 .\"O prints the graph profile entry of only the routine
239 .\"O .I name
240 .\"O and its descendants (as
241 .\"O .B \-f ,
242 .\"O above) and also uses only the times of the printed routines
243 .\"O in total time and percentage computations.
244 .\"O More than one
245 .\"O .B \-F
246 .\"O option may be given.
247 .\"O Only one
248 .\"O .I name
249 .\"O may be given with each
250 .\"O .B \-F
251 .\"O option.
252 .\"O The
253 .\"O .B \-F
254 .\"O option
255 .\"O overrides
256 .\"O the
257 .\"O .B \-E
258 .\"O option.
259 .B \-f
260 と同様に、ルーチン
261 .I name
262 とその子孫に関してのみ、グラフプロファイルのエントリを表示する。またこ
263 れらによって用いられた時間だけを合計の実行時間とパーセンテージの計算に
264 用いる。
265 .B \-F
266 オプションは複数指定できる。一つの
267 .B \-F
268 オプションについて指定できる
269 .I name
270 は一つだけである。
271 .B \-F
272 オプションは
273 .B \-E
274 オプションによる設定を上書きする。
275 .TP
276 .BI "\-k " "fromname toname"
277 .\"O will delete any arcs from routine
278 .\"O .I fromname
279 .\"O to routine
280 .\"O .IR toname  .
281 .\"O This can be used to break undesired cycles.
282 .\"O More than one
283 .\"O .B \-k
284 .\"O option may be given.
285 .\"O Only one pair of routine names may be given with each
286 .\"O .B \-k
287 .\"O option.
288 ルーチン
289 .I fromname
290 からルーチン
291 .I toname
292 までの枝を削除する。これは不要なサイクルの循環を破壊するのに便利である。
293 .B \-k
294 は複数指定できる。一つの
295 .B \-k
296 オプションに対して指定できるのは一組のルーチン名だけである。
297 .TP
298 .B \-s
299 .\"O a profile file `gmon.sum' is produced that represents
300 .\"O the sum of the profile information in all the specified profile files.
301 .\"O This summary profile file may be given to later
302 .\"O executions of gprof (probably also with a
303 .\"O .BR \-s  )
304 .\"O to accumulate profile data across several runs of an `objfile' file.
305 プロファイルファイル `gmon.sum' を作成し、指定したプロファイルファイル
306 の情報すべてからのプロファイル情報を総計したものを書き込む。この合計プ
307 ロファイルファイルは後に gprof を (おそらくは
308 .B \-s
309 と共に) 実行する際に与えて、 `objfile' ファイルを複数回実行して得られ
310 たプロファイルデータを累積するために用いることもできる。
311 .TP
312 .\"O .B -v
313 .B \-v
314 .\"O prints the version number for gprof, and then exits.
315 gprof のバージョン番号を表示して終了する。
316 .TP
317 .\"O .B -z
318 .B \-z
319 .\"O displays routines that have zero usage (as shown by call counts
320 .\"O and accumulated time).
321 .\"O This is useful with the
322 .\"O .B \-c
323 .\"O option for discovering which routines were never called.
324 用いられなかった関数 (呼び出し回数と実行時間でわかる) も表示する。これ
325
326 .B \-c
327 オプションと共に用いると、呼び出されなかったルーチンを見つけるのに役
328 に立つ。
329 .PP
330 .\"O .SH FILES
331 .SH ファイル
332 .\"O .ta \w'gmon.sum 'u
333 .\"O a.out      the namelist and text space.
334 a.out       名前のリストとテキスト空間
335 .br
336 .\"O gmon.out   dynamic call graph and profile.
337 gmon.out    ダイナミックなコール・グラフとプロファイル
338 .br
339 .\"O gmon.sum summarized dynamic call graph and profile.
340 gmon.sum    ダイナミックなコール・グラフとプロファイルのまとめ
341
342 .\"O .SH SEE ALSO
343 .SH 関連項目
344 .BR monitor ( 3 ) ,
345 .BR profil ( 2 ) ,
346 .BR cc ( 1 ) ,
347 .BR prof ( 1 )
348 .sp
349 ``An Execution Profiler for Modular Programs'',
350 by S. Graham, P. Kessler, M. McKusick;
351 .I
352 Software \- Practice and Experience,
353 Vol. 13, pp. 671-685, 1983.
354 .sp
355 ``gprof: A Call Graph Execution Profiler'',
356 by S. Graham, P. Kessler, M. McKusick;
357 .I
358 Proceedings of the SIGPLAN '82 Symposium on Compiler Construction,
359 SIGPLAN Notices, Vol. 17, No  6, pp. 120-126, June 1982.
360
361 .\"O .SH HISTORY
362 .SH 履歴
363 .\"O .B Gprof
364 .\"O appeared in 4.2 BSD.
365 .B gprof
366 は 4.2 BSD から登場した。
367 .\"O .SH BUGS
368 .SH バグ
369 .\"O The granularity of the sampling is shown, but remains
370 .\"O statistical at best.
371 .\"O We assume that the time for each execution of a function
372 .\"O can be expressed by the total time for the function divided
373 .\"O by the number of times the function is called.
374 .\"O Thus the time propagated along the call graph arcs to the function's
375 .\"O parents is directly proportional to the number of times that
376 .\"O arc is traversed.
377 サンプリングの粒度 (granularity) も表示されるが、せいぜい統計的なもの
378 でしかない。ここでは関数の一回あたりの実行時間は、関数の消費した合計時
379 間を呼び出し回数で割ったものと仮定している。したがって、呼び出しグラフの
380 枝を伝播して関数の親に伝わる時間は、枝を通過した回数に直に比例すること
381 になる。
382 .PP
383 .\"O Parents that are not themselves profiled will have the time of
384 .\"O their profiled children propagated to them, but they will appear
385 .\"O to be spontaneously invoked in the call graph listing, and will
386 .\"O not have their time propagated further.
387 .\"O Similarly, signal catchers, even though profiled, will appear
388 .\"O to be spontaneous (although for more obscure reasons).
389 .\"O Any profiled children of signal catchers should have their times
390 .\"O propagated properly, unless the signal catcher was invoked during
391 .\"O the execution of the profiling routine, in which case all is lost.
392 自分自身がプロファイルされていない親でも、子から伝播してくる時間を保有
393 することになる。しかしこれらのルーチンは、呼び出しグラフの中で (どこか
394 ら呼び出されたのでもなく) 勝手に起動するように見えるので、その時間はそ
395 れ以上どこへも伝播しない。同様に、シグナルをキャッチしたルーチンは、プ
396 ロファイルされていても勝手に起動するように見えてしまう (理由はもう少し
397 複雑だが)。シグナルをキャッチしたルーチンの子がプロファイルされてい
398 ればその時間を正しく伝播させることができるが、親ルーチンがプロファ
399 イルルーチンの途中でシグナルがキャッチされた場合には全ての情報は失われる。
400 .PP
401 .\"O The profiled program must call
402 .\"O .BR exit ( 2 )
403 .\"O or return normally for the profiling information to be saved
404 .\"O in the `gmon.out' file.
405 プロファイルされるプログラムは
406 .BR exit ( 2 )
407 をコールして終了するか、 main ルーチンからの return で終了しなければな
408 らない。さもないと終了時にプロファイル情報が `gmon.out' ファイルにセー
409 ブされない。