2 .\" Japanese Version Copyright (c) 1997 Koso Fukuba
3 .\" all rights reserved.
4 .\" Translated Mon Jan 27 12:00:00 JST 1997
5 .\" by Koso Fukuba <koso@ga2.so-net.or.jp>
7 .\" Translated Tue Sep 02 12:00:00 JST 1997
8 .\" by Koso Fukuba <koso@ga2.so-net.or.jp>
10 .\" Updated Mon Apr 9 20:17:43 JST 2001
11 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
12 .\" Updated & Modified Wed Aug 28 04:34:09 JST 2002 by Yuichi SATO
13 .\" Updated & Modified Sat May 1 17:16:36 JST 2004 by Yuichi SATO
15 .TH READPROFILE 1 "May 1996"
19 .\"O readprofile - a tool to read kernel profiling information
20 readprofile - ¥«¡¼¥Í¥ë¤Î¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¾ðÊó¤òÆɤߤÀ¤¹¥Ä¡¼¥ë
30 .\"O This manpage documents version 2.0 of the program.
31 ¤³¤Î¥ª¥ó¥é¥¤¥ó¥Þ¥Ë¥å¥¢¥ë¤Ï¡¢¥Ð¡¼¥¸¥ç¥ó 2.0 ¤Î¤â¤Î¤Ç¤¢¤ë¡£
41 .\"O information to print ascii data on standard output.
45 ¤Î¾ðÊó¤òɸ½à½ÐÎϤ˽ÐÎϤ¹¤ë¡£
47 .\"O organized in three columns: the first is the number of clock ticks,
48 .\"O the second is the name of the C function in the kernel where those many
49 .\"O ticks occurred, and the third is the normalized `load' of the procedure,
50 .\"O calculated as a ratio between the number of ticks and the length of
51 .\"O the procedure. The output is filled with blanks to ease readability.
52 ½ÐÎϤµ¤ì¤ë¾ðÊó¤Ï¡¢3 ¼ïÎà¤Î¾ðÊ󤫤鹽À®¤µ¤ì¤Æ¤¤¤ë¡£
53 ºÇ½é¤Î¹àÌܤϡ¢¥¯¥í¥Ã¥¯¥Á¥Ã¥¯ (clock tick) ¤Ç¤¢¤ë¡£
54 2 ÈÖÌܤϡ¢¤¿¤¯¤µ¤ó¤Î»þ´Ö¤ò¾ÃÈñ¤·¤Æ¤¤¤ë¥«¡¼¥Í¥ëÆâÉô¤Î C ¤Î´Ø¿ô̾¤Ç¤¢¤ë¡£
55 3 ÈÖÌܤιàÌܤϡ¢¼ê³¤¤Î¡ÖÉé²Ù¡×¤òÀµµ¬²½¤·¤¿¤â¤Î¤Ç¡¢
56 ´Ø¿ô¤ÎŤµ¤È¥¯¥í¥Ã¥¯¿ô¤ÎÈæΨ¤È¤·¤Æ·×»»¤µ¤ì¤ë¡£
57 ¤³¤ì¤é¤Î¹àÌܤϡ¢Æɤ߼è¤ê¤ä¤¹¤¤¤è¤¦¤Ë¶õÇò¤òÆþ¤ì¡¢·å¤ò·¤¨¤Æ½ÐÎϤµ¤ì¤ë¡£
60 .\"O Available command line options are the following:
61 ¼¡¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó¤ò»ØÄê¤Ç¤¤ë:
65 .\"O Specify a mapfile, which by default is
66 .\"O .B /usr/src/linux/System.map.
67 .\"O You should specify the map file on cmdline if your current kernel isn't the
68 .\"O last one you compiled, or if you keep System.map elsewhere. If the name of
69 .\"O the map file ends with `.gz' it is decompressed on the fly.
70 ¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ë¡£
72 .B /usr/src/linux/System.map
74 ¸½ºß¤Î¥«¡¼¥Í¥ë¤¬ºÇ¸å¤Ë¥³¥ó¥Ñ¥¤¥ë¤·¤¿¤â¤Î¤Ç¤Ê¤¤¾ì¹ç¡¢
75 ¤Þ¤¿¤Ï System.map ¤ò¾¤Î¾ì½ê¤ËÊݸ¤·¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
76 ¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ëɬÍפ¬¤¢¤ë¡£
77 ¥Þ¥Ã¥×¥Õ¥¡¥¤¥ë̾¤ÎºÇ¸å¤¬ `.gz' ¤È¤Ê¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢
78 ¼Â¹Ô»þ¤Ë¼«Æ°Åª¤Ë¿Ä¹¤µ¤ì¤ë¡£
82 .\"O Specify a different profiling buffer, which by default is
83 .\"O .B /proc/profile.
84 .\"O Using a different pro-file is useful if you want to `freeze' the
85 .\"O kernel profiling at some time and read it later. The
87 .\"O file can be copied using `cat' or `cp'. There is no more support for
88 .\"O compressed profile buffers, like in
89 .\"O .B readprofile-1.1,
90 .\"O because the program needs to know the size of the buffer in advance.
91 Ê̤Υץí¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò»ØÄꤹ¤ë¡£
95 Ê̤Υץí¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò»ÈÍѤ¹¤ë¤È¡¢
96 ¥«¡¼¥Í¥ë¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤ò¡ÖÅà·ë¡×¤·¤¿¸å¤Ç
97 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¾ðÊó¤òÆɤà¾ì¹ç¤Ê¤É¤ËÍÍѤǤ¢¤ë¡£
99 ¤Ï¡¢`cat' ¤ä¡¢`cp' ¥³¥Þ¥ó¥É¤ò»È¤Ã¤Æ¥³¥Ô¡¼¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
100 ¥×¥í¥°¥é¥à¤¬¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤ò
101 Á°¤â¤Ã¤Æ¼èÆÀ¤¹¤ëɬÍפ¬¤¢¤ë¤¿¤á¡¢
104 °µ½Ì¤µ¤ì¤¿¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£
108 .\"O Info. This makes
110 .\"O only print the profiling step used by the kernel.
111 .\"O The profiling step is the resolution of the profiling buffer, and
112 .\"O is chosen during kernel configuration (through `make config'),
113 .\"O or in the kernel's command line.
116 .\"O (terse) switch is used together with
118 .\"O only the decimal number is printed.
119 ¥«¡¼¥Í¥ë¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¾ðÊó¤Îɽ¼¨¡£
120 ¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¤È¡¢
122 ¤Ï¡¢¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤Æ»ÈÍѤµ¤ì¤Æ¤¤¤ë
123 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥¹¥Æ¥Ã¥×¤Î¤ß¤òɽ¼¨¤¹¤ë¡£
124 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥¹¥Æ¥Ã¥×¤Ï¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ÎÀºÅ٤Ǥ¢¤ê¡¢
125 (make config ¤ò»È¤Ã¤¿) ¥«¡¼¥Í¥ë¤ÎÀßÄê¡¢
126 ¤Þ¤¿¤Ï¥«¡¼¥Í¥ë¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¤Ç»ØÄꤵ¤ì¤ë¡£
128 (terse: ´Ê·é¥â¡¼¥É) ¥¹¥¤¥Ã¥Á¤¬
130 ¤È°ì½ï¤Ë»ØÄꤵ¤ì¤ë¤È¡¢Ã±¤Ë 10 ¿Ê¿ô¤Î¿ô»ú¤Î¤ß¤¬É½¼¨¤µ¤ì¤ë¡£
134 .\"O Print all symbols in the mapfile. By default the procedures with 0 reported
135 .\"O ticks are not printed.
136 ¥Þ¥Ã¥×¥Õ¥¡¥¤¥ëÃæ¤Î¤¹¤Ù¤Æ¤Î¥·¥ó¥Ü¥ë¤òɽ¼¨¤¹¤ë¡£
137 ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢»ÈÍÑ¥¯¥í¥Ã¥¯¿ô¤¬ 0 ¤Î¼ê³¤¤Ï½ÐÎϤµ¤ì¤Ê¤¤¡£
141 .\"O Print individual histogram-bin counts.
142 ³Æ¥á¥â¥êÎΰè¤ËÂФ¹¤ë½Ð¸½¿ô¤Î¥«¥¦¥ó¥È¤òɽ¼¨¤¹¤ë¡£
146 .\"O Reset the profiling buffer. This can only be invoked by root, because
147 .\"O .B /proc/profile
148 .\"O is readable by everybody but writable only by the superuser. However,
151 .\"O setuid 0, in order to reset the buffer without gaining privileges.
152 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤò½é´ü²½¤¹¤ë¡£
154 ¤Ï¡¢¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¡¼¤À¤±¤¬½ñ¤¹þ¤ß²Äǽ¤Ç¡¢
155 °ìÈ̥桼¥¶¡¼¤ÏÆɤ߹þ¤ß¤·¤«¤Ç¤¤Ê¤¤¤¿¤á¡¢
156 ¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ÈÍѤ¹¤ë¤Ë¤Ï¡¢¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¡¼¤Î¸¢¸Â¤¬É¬ÍפȤʤ롣
159 ¤ò setuid 0 ¤È¤¹¤ë¤³¤È¤Ç¡¢Æø¢¤ò»ý¤¿¤Ê¤¤¥æ¡¼¥¶¡¼¤Ç¤â
160 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤò½é´ü²½¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
164 .\"O On some architectures it is possible to alter the frequency at which
165 .\"O the kernel delivers profiling interrupts to each CPU. This option allows you to
166 .\"O set the frequency, as a multiplier of the system clock frequency, HZ.
167 .\"O This is supported on i386-SMP (2.2 and 2.4 kernel) and also on sparc-SMP
168 .\"O and sparc64-SMP (2.4 kernel). This option also resets the profiling buffer,
169 .\"O and requires superuser privileges.
170 ¥«¡¼¥Í¥ë¤¬¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°³ä¤ê¹þ¤ß¤ò³Æ CPU ¤ËÁ÷¤ë¼þ´ü¤òÊѹ¹¤Ç¤¤ë
171 ¥¢¡¼¥¥Æ¥¯¥Á¥ã¤â¤¢¤ë¡£
172 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ë¤è¤ê¡¢
173 ¼þ´ü¤ò¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¼þÇÈ¿ô HZ ¤ÎÇÜ¿ô¤ÇÀßÄê¤Ç¤¤ë¡£
174 i386-SMP (2.2 ¤È 2.4 ¥«¡¼¥Í¥ë) ¤È
175 sparc64-SMP (2.4 ¥«¡¼¥Í¥ë) ¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
176 ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Î½é´ü²½¤â¹Ô¤¦¤Î¤Ç¡¢
177 ¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¡¼Æø¢¤¬É¬ÍפǤ¢¤ë¡£
181 .\"O Verbose. The output is organized in four columns and filled with blanks.
182 .\"O The first column is the RAM address of a kernel function, the second is
183 .\"O the name of the function, the third is the number of clock ticks and the
184 .\"O last is the normalized load.
186 ½ÐÎÏ¤Ï 4 ¤Ä¤Î¹àÌܤ«¤é¹½À®¤µ¤ì¡¢¤½¤ì¤¾¤ì¶õÇò¤Ë¤è¤ê·å¤¬Â·¤¨¤é¤ì¤ë¡£
187 ºÇ½é¤Î¹àÌܤϥ«¡¼¥Í¥ë¤Î´Ø¿ô¤Î RAM ¥¢¥É¥ì¥¹¡¢
188 2 ÈÖÌܤιàÌܤϴؿô¤Î̾Á°¡¢
189 3 ÈÖÌܤιàÌܤϻÈÍѤ·¤¿¥¯¥í¥Ã¥¯¿ô¡¢
190 ºÇ¸å¤Î¹àÌܤˤÏÀµµ¬²½¤µ¤ì¤¿Éé²Ù¤¬É½¼¨¤µ¤ì¤ë¡£
194 .\"O Version. This makes
196 .\"O print its version number and exit.
197 ¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤Îɽ¼¨¡£
199 ¤Ï¡¢¸½ºß¤Î¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤·¤¿¸å¡¢½ªÎ»¤¹¤ë¡£
203 .\"O Browse the profiling buffer ordering by clock ticks:
204 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤò»ÈÍѤ·¤¿¥¯¥í¥Ã¥¯¿ô¤Î½ç¤Ëɽ¼¨¤¹¤ë¤Ë¤Ï:
206 readprofile | sort -nr | less
209 .\"O Print the 20 most loaded procedures:
210 ºÇ¤â¤¿¤¯¤µ¤ó¥¯¥í¥Ã¥¯¤ò»ÈÍѤ·¤¿´Ø¿ô¤Î¾å°Ì 20 ¸Ä¤òɽ¼¨¤¹¤ë¤Ë¤Ï:
212 readprofile | sort -nr +2 | head -20
215 .\"O Print only filesystem profile:
216 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¾ðÊó¤À¤±¤òɽ¼¨¤¹¤ë¤Ë¤Ï:
218 readprofile | grep _ext2
221 .\"O Look at all the kernel information, with ram addresses"
222 ¤¹¤Ù¤Æ¤Î¥«¡¼¥Í¥ë¾ðÊó¤ò RAM ¥¢¥É¥ì¥¹¤È°ì½ï¤Ëɽ¼¨¤µ¤»¤ë¤Ë¤Ï:
224 readprofile -av | less
227 .\"O Browse a `freezed' profile buffer for a non current kernel:
228 ¸½ºß¤Î¥«¡¼¥Í¥ë¤Î¤â¤Î¤Ç¤Ï¤Ê¤¤¡ÖÅà·ë¤µ¤ì¤¿¡×
229 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤòɽ¼¨¤¹¤ë¤Ë¤Ï:
231 readprofile -p ~/profile.freeze -m /zImage.map.gz
234 .\"O Request profiling at 2kHz per CPU, and reset the profiling buffer
235 ³Æ CPU ¤ËÂФ·¤Æ 2kHz ¤Î¼þ´ü¤Ç¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤òÍ׵ᤷ¡¢
236 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò½é´ü²½¤¹¤ë¤Ë¤Ï:
238 sudo readprofile -M 20
247 .\"O only works with an 1.3.x or newer kernel,
249 .\"O .B /proc/profile
250 .\"O changed in the step from 1.2 to 1.3
251 ¥«¡¼¥Í¥ë¥Ð¡¼¥¸¥ç¥ó 1.2 ¤«¤é 1.3 ¤Ç
255 ¤Ï 1.3.x °Ê¹ß¤Î¥«¡¼¥Í¥ë¤Ç¤Î¤ßÆ°ºî¤¹¤ë¡£
258 .\"O This program only works with ELF kernels. The change for a.out kernels
259 .\"O is trivial, and left as an exercise to the a.out user.
260 ¤³¤Î¥×¥í¥°¥é¥à¤Ï¡¢ELF ¥«¡¼¥Í¥ë¤Ç¤Î¤ßÆ°ºî¤¹¤ë¡£
261 a.out ¥«¡¼¥Í¥ë¤Ø¤ÎÊѹ¹¤ÏÂ礤ʺî¶È¤Ç¤Ï¤Ê¤¤¡£
262 a.out ¥«¡¼¥Í¥ë¥æ¡¼¥¶¡¼¤Ø¤ÎÎý½¬ÌäÂê¤È¤·¤Æ»Ä¤·¤Æ¤¢¤ë¡£
265 .\"O To enable profiling, the kernel must be rebooted, because no profiling module
266 .\"O is available, and it wouldn't be easy to build. To enable profiling,
267 .\"O you can specify "profile=2" (or another number) on the kernel commandline.
268 .\"O The number you specify is the two-exponent used as profiling step.
269 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢
270 ¥«¡¼¥Í¥ë¤Î (ºÆ¹½ÃÛ¤È) ¥ê¥Ö¡¼¥È¤¬É¬ÍפǤ¢¤ë¡£
271 ¤³¤ì¤Ï¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°ÍѤΥ⥸¥å¡¼¥ë¤Ï¸ºß¤»¤º¡¢
272 ¤«¤Ä¡¢´Êñ¤Ë¤Ïºî¤ì¤Ê¤¤¤¿¤á¤Ç¤¢¤ë¡£
273 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤ò͸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢¥«¡¼¥Í¥ë¤Î¥³¥Þ¥ó¥É¥é¥¤¥ó¾å¤Ç¡¢
274 "profile=2" (¤Þ¤¿¤Ï¡¢Ê̤οô»ú) ¤ò»ØÄꤹ¤ëɬÍפ¬¤¢¤ë¡£
275 ¤³¤Î¿ô»ú¤ò»Ø¿ô¤È¤·¤Æ 2 ¤òÎ߾褷¤¿¤â¤Î¤¬¡¢
276 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥¹¥Æ¥Ã¥×¤È¤·¤Æ»ÈÍѤµ¤ì¤ë¡£
279 .\"O Profiling is disabled when interrupts are inhibited. This means that many
280 .\"O profiling ticks happen when interrupts are re-enabled. Watch out for
281 .\"O misleading information.
282 ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Ï¡¢³ä¤ê¹þ¤ß¤¬¶Ø»ß¤µ¤ì¤Æ¤¤¤ë¤È»ÈÍѤǤ¤Ê¤¤¡£
283 ¤³¤ì¤Ï¡¢³ä¤ê¹þ¤ß¤òºÆ¤Ó͸ú¤Ë¤¹¤ë¤È¤¤Ë¡¢
284 ¿¤¯¤Î¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Î¥«¥¦¥ó¥È¤¬¹Ô¤ï¤ì¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
285 ¸í¤Ã¤¿¾ðÊó¤ËÃí°Õ¤¹¤ë¤³¤È¡£
290 .\"O /proc/profile A binary snapshot of the profiling buffer.
291 .\"O /usr/src/linux/System.map The symbol table for the kernel.
292 .\"O /usr/src/linux/* The program being profiled :-)
293 /proc/profile ¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤Î¥Ð¥¤¥Ê¥ê¥¹¥Ê¥Ã¥×¥·¥ç¥Ã¥È
294 /usr/src/linux/System.map ¥«¡¼¥Í¥ë¤Î¥·¥ó¥Ü¥ë¥Æ¡¼¥Ö¥ë
295 /usr/src/linux/* ¥×¥í¥Õ¥¡¥¤¥ë¤µ¤ì¤ë¥×¥í¥°¥é¥à :-)