]>
Commit | Line | Data |
---|---|---|
c74138a1 | 1 | .TH READPROFILE "8" "October 2011" "util-linux" "System Administration" |
6dbe3af9 | 2 | .SH NAME |
232dc924 | 3 | readprofile - read kernel profiling information |
6dbe3af9 KZ |
4 | .SH SYNOPSIS |
5 | .B readprofile | |
fd22da56 | 6 | .RI [ options ] |
6dbe3af9 | 7 | .SH VERSION |
fd6b7a7f | 8 | This manpage documents version 2.0 of the program. |
6dbe3af9 | 9 | .SH DESCRIPTION |
6dbe3af9 KZ |
10 | .LP |
11 | The | |
12 | .B readprofile | |
fd22da56 | 13 | command uses the |
6dbe3af9 | 14 | .B /proc/profile |
c74138a1 | 15 | information to print ascii data on standard output. The output is |
6dbe3af9 | 16 | organized in three columns: the first is the number of clock ticks, |
c74138a1 SK |
17 | the second is the name of the C function in the kernel where those |
18 | many ticks occurred, and the third is the normalized `load' of the | |
19 | procedure, calculated as a ratio between the number of ticks and the | |
20 | length of the procedure. The output is filled with blanks to ease | |
21 | readability. | |
22 | .SH OPTIONS | |
6dbe3af9 | 23 | .TP |
c74138a1 | 24 | \fB\-m\fR, \fB\-\-mapfile\fR \fImapfile\fR |
6dbe3af9 | 25 | Specify a mapfile, which by default is |
c74138a1 SK |
26 | .BR /usr/src/linux/System.map . |
27 | You should specify the map file on cmdline if your current kernel | |
28 | isn't the last one you compiled, or if you keep System.map elsewhere. | |
29 | If the name of the map file ends with `.gz' it is decompressed on the | |
30 | fly. | |
6dbe3af9 | 31 | .TP |
c74138a1 | 32 | \fB\-p\fR, \fB\-\-profile\fR \fIpro-file\fR |
6dbe3af9 KZ |
33 | Specify a different profiling buffer, which by default is |
34 | .B /proc/profile. | |
35 | Using a different pro-file is useful if you want to `freeze' the | |
c74138a1 | 36 | kernel profiling at some time and read it later. The |
6dbe3af9 | 37 | .B /proc/profile |
c74138a1 | 38 | file can be copied using `cat' or `cp'. There is no more support for |
fd22da56 | 39 | compressed profile buffers, like in |
fd6b7a7f KZ |
40 | .B readprofile-1.1, |
41 | because the program needs to know the size of the buffer in advance. | |
6dbe3af9 | 42 | .TP |
c74138a1 SK |
43 | \fB\-i\fR, \fB\-\-info\fR |
44 | Info. This makes | |
6dbe3af9 | 45 | .B readprofile |
c74138a1 SK |
46 | only print the profiling step used by the kernel. The profiling step |
47 | is the resolution of the profiling buffer, and is chosen during | |
48 | kernel configuration (through `make config'), or in the kernel's | |
49 | command line. If the | |
fd22da56 | 50 | .B \-t |
6dbe3af9 | 51 | (terse) switch is used together with |
fd22da56 | 52 | .B \-i |
6dbe3af9 | 53 | only the decimal number is printed. |
6dbe3af9 | 54 | .TP |
c74138a1 SK |
55 | \fB\-a\fR, \fB\-\-all\fR |
56 | Print all symbols in the mapfile. By default the procedures with | |
57 | reported ticks are not printed. | |
f0c8eda1 | 58 | .TP |
c74138a1 | 59 | \fB\-b\fR, \fB\-\-histbin\fR |
f0c8eda1 | 60 | Print individual histogram-bin counts. |
6dbe3af9 | 61 | .TP |
c74138a1 SK |
62 | \fB\-r\fR, \fB\-\-reset\fR |
63 | Reset the profiling buffer. This can only be invoked by root, | |
64 | because | |
6dbe3af9 | 65 | .B /proc/profile |
c74138a1 SK |
66 | is readable by everybody but writable only by the superuser. |
67 | However, you can make | |
fd6b7a7f KZ |
68 | .B readprofile |
69 | setuid 0, in order to reset the buffer without gaining privileges. | |
c07ebfa1 | 70 | .TP |
c74138a1 | 71 | \fB\-M\fR, \fB\-\-multiplier\fR \fImultiplier\fR |
c07ebfa1 | 72 | On some architectures it is possible to alter the frequency at which |
c74138a1 SK |
73 | the kernel delivers profiling interrupts to each CPU. This option |
74 | allows you to set the frequency, as a multiplier of the system clock | |
75 | frequency, HZ. This is supported on i386-SMP (2.2 and 2.4 kernel) | |
76 | and also on sparc-SMP and sparc64-SMP (2.4 kernel). This option also | |
77 | resets the profiling buffer, and requires superuser privileges. | |
6dbe3af9 | 78 | .TP |
c74138a1 SK |
79 | \fB\-v\fR, \fB\-\-verbose\fR |
80 | Verbose. The output is organized in four columns and filled with | |
81 | blanks. The first column is the RAM address of a kernel function, | |
82 | the second is the name of the function, the third is the number of | |
83 | clock ticks and the last is the normalized load. | |
6dbe3af9 | 84 | .TP |
c74138a1 SK |
85 | \fB\-V\fR, \fB\-\-version\fR |
86 | This makes | |
6dbe3af9 KZ |
87 | .B readprofile |
88 | print its version number and exit. | |
c74138a1 SK |
89 | .TP |
90 | \fB\-h\fR, \fB\-\-help\fR | |
91 | Display help and exit. | |
6dbe3af9 KZ |
92 | .SH EXAMPLES |
93 | Browse the profiling buffer ordering by clock ticks: | |
94 | .nf | |
95 | readprofile | sort -nr | less | |
96 | ||
97 | .fi | |
98 | Print the 20 most loaded procedures: | |
99 | .nf | |
100 | readprofile | sort -nr +2 | head -20 | |
101 | ||
102 | .fi | |
103 | Print only filesystem profile: | |
104 | .nf | |
105 | readprofile | grep _ext2 | |
106 | ||
107 | .fi | |
c74138a1 | 108 | Look at all the kernel information, with ram addresses: |
6dbe3af9 KZ |
109 | .nf |
110 | readprofile -av | less | |
111 | ||
112 | .fi | |
fd6b7a7f | 113 | Browse a `freezed' profile buffer for a non current kernel: |
6dbe3af9 | 114 | .nf |
fd6b7a7f | 115 | readprofile -p ~/profile.freeze -m /zImage.map.gz |
6dbe3af9 | 116 | |
c07ebfa1 | 117 | .fi |
c74138a1 | 118 | Request profiling at 2kHz per CPU, and reset the profiling buffer: |
c07ebfa1 KZ |
119 | .nf |
120 | sudo readprofile -M 20 | |
6dbe3af9 | 121 | .fi |
6dbe3af9 | 122 | .SH BUGS |
6dbe3af9 KZ |
123 | .LP |
124 | .B readprofile | |
c74138a1 | 125 | only works with an 1.3.x or newer kernel, because |
6dbe3af9 | 126 | .B /proc/profile |
fd6b7a7f | 127 | changed in the step from 1.2 to 1.3 |
6dbe3af9 | 128 | .LP |
c74138a1 SK |
129 | This program only works with ELF kernels. The change for a.out |
130 | kernels is trivial, and left as an exercise to the a.out user. | |
fd6b7a7f | 131 | .LP |
c74138a1 SK |
132 | To enable profiling, the kernel must be rebooted, because no |
133 | profiling module is available, and it wouldn't be easy to build. To | |
134 | enable profiling, you can specify "profile=2" (or another number) on | |
135 | the kernel commandline. The number you specify is the two-exponent | |
136 | used as profiling step. | |
6dbe3af9 | 137 | .LP |
c74138a1 SK |
138 | Profiling is disabled when interrupts are inhibited. This means that |
139 | many profiling ticks happen when interrupts are re-enabled. Watch | |
140 | out for misleading information. | |
6dbe3af9 KZ |
141 | .SH FILES |
142 | .nf | |
143 | /proc/profile A binary snapshot of the profiling buffer. | |
144 | /usr/src/linux/System.map The symbol table for the kernel. | |
6dbe3af9 KZ |
145 | /usr/src/linux/* The program being profiled :-) |
146 | .fi | |
86d62711 | 147 | .SH AVAILABILITY |
c74138a1 SK |
148 | The readprofile command is part of the util-linux package and is |
149 | available from | |
150 | .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ | |
151 | Linux Kernel Archive | |
152 | .UE . |