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