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