version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
READPROFILE |
|
|
2 |
!!!READPROFILE |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
VERSION |
|
|
6 |
DESCRIPTION |
|
|
7 |
EXAMPLES |
|
|
8 |
BUGS |
|
|
9 |
FILES |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
readprofile - a tool to read kernel profiling information |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__readprofile__ [[ ''options'' ] |
|
|
19 |
!!VERSION |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
This manpage documents version 2.0 of the |
|
|
23 |
program. |
|
|
24 |
!!DESCRIPTION |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
The __readprofile__ command uses the __/proc/profile__ |
|
|
28 |
information to print ascii data on standard output. The |
|
|
29 |
output is organized in three columns: the first is the |
|
|
30 |
number of clock ticks, the second is the name of the C |
|
|
31 |
function in the kernel where those many ticks occurred, and |
|
|
32 |
the third is the normalized `load' of the procedure, |
|
|
33 |
calculated as a ratio between the number of ticks and the |
|
|
34 |
length of the procedure. The output is filled with blanks to |
|
|
35 |
ease readability. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
Available command line options are the |
|
|
39 |
following: |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
-m __mapfile__ |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
Specify a mapfile, which by default is |
|
|
46 |
__/usr/src/linux/System.map.__ You should specify the map |
|
|
47 |
file on cmdline if your current kernel isn't the last one |
|
|
48 |
you compiled. If the name of the map file ends with `.gz' it |
|
|
49 |
is decompressed on the fly. |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
-p __pro-file__ |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
Specify a different profiling buffer, which by default is |
|
|
56 |
__/proc/profile.__ Using a different pro-file is useful |
|
|
57 |
if you want to `freeze' the kernel profiling at some time |
|
|
58 |
and read it later. The __/proc/profile__ file can be |
|
|
59 |
copied using `cat' or `cp'. There is no more support for |
|
|
60 |
compressed profile buffers, like in __readprofile-1.1,__ |
|
|
61 |
because the program needs to know the size of the buffer in |
|
|
62 |
advance. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
__-i__ |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
Info. This makes __readprofile__ only print the profiling |
|
|
69 |
step used by the kernel. The profiling step is the |
|
|
70 |
resolution of the profiling buffer, and is chosen during |
|
|
71 |
kernel configuration (through `make config'), or in the |
|
|
72 |
kernel's command line. If the __-t__ (terse) switch is |
|
|
73 |
used together with __-i__ only the decimal number is |
|
|
74 |
printed. |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
__-a__ |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
Print all symbols in the mapfile. By default the procedures |
|
|
81 |
with 0 reported ticks are not printed. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
__-r__ |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
Reset the profiling buffer. This can only be invoked by |
|
|
88 |
root, because __/proc/profile__ is readable by everybody |
|
|
89 |
but writable only by the superuser. However, you can make |
|
|
90 |
__readprofile__ setuid 0, in order to reset the buffer |
|
|
91 |
without gaining privileges. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
-M __multiplier__ |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
On some architectures it is possible to alter the frequency |
|
|
98 |
at which the kernel delivers profiling interrupts to each |
|
|
99 |
CPU. This option allows you to set the frequency, as a |
|
|
100 |
multiplier of the system clock frequency, HZ. This is |
|
|
101 |
supported on i386-SMP (2.2 and 2.4 kernel) and also on |
|
|
102 |
sparc-SMP and sparc64-SMP (2.4 kernel). This option also |
|
|
103 |
resets the profiling buffer, and requires superuser |
|
|
104 |
privileges. |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
__-v__ |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
Verbose. The output is organized in four columns and filled |
|
|
111 |
with blanks. The first column is the RAM address of a kernel |
|
|
112 |
function, the second is the name of the function, the third |
|
|
113 |
is the number of clock ticks and the last is the normalized |
|
|
114 |
load. |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
__-V__ |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
Version. This makes __readprofile__ print its version |
|
|
121 |
number and exit. |
|
|
122 |
!!EXAMPLES |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
Browse the profiling buffer ordering by clock |
|
|
126 |
ticks: |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
readprofile | sort -nr | less |
|
|
130 |
Print the 20 most loaded procedures: |
|
|
131 |
|
|
|
132 |
|
|
|
133 |
readprofile | sort -nr +2 | head -20 |
|
|
134 |
Print only filesystem profile: |
|
|
135 |
|
|
|
136 |
|
|
|
137 |
readprofile | grep _ext2 |
|
|
138 |
Look at all the kernel information, with ram addresses |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
readprofile -av | less |
|
|
142 |
Browse a `freezed' profile buffer for a non current kernel: |
|
|
143 |
|
|
|
144 |
|
|
|
145 |
readprofile -p ~/profile.freeze -m /zImage.map.gz |
|
|
146 |
Request profiling at 2kHz per CPU, and reset the profiling buffer |
|
|
147 |
|
|
|
148 |
|
|
|
149 |
sudo readprofile -M 20 |
|
|
150 |
!!BUGS |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
__readprofile__ only works with an 1.3.x or newer kernel, |
|
|
154 |
because __/proc/profile__ changed in the step from 1.2 to |
|
|
155 |
1.3 |
|
|
156 |
|
|
|
157 |
|
|
|
158 |
This program only works with ELF kernels. The change for |
|
|
159 |
a.out kernels is trivial, and left as an exercise to the |
|
|
160 |
a.out user. |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
To enable profiling, the kernel must be rebooted, because no |
|
|
164 |
profiling module is available, and it wouldn't be easy to |
|
|
165 |
build. To enable profiling, you can specify |
|
|
166 |
|
|
|
167 |
|
|
|
168 |
Profiling is disabled when interrupts are inhibited. This |
|
|
169 |
means that many profiling ticks happen when interrupts are |
|
|
170 |
re-enabled. Watch out for misleading |
|
|
171 |
information. |
|
|
172 |
!!FILES |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
/proc/profile A binary snapshot of the profiling buffer. |
|
|
176 |
/usr/src/linux/System.map The symbol table for the kernel. |
|
|
177 |
/usr/src/linux/* The program being profiled :-) |
|
|
178 |
---- |