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 Browse the profiling buffer ordering by clock ticks:
86 readprofile | sort -nr | less
87
88 Print the 20 most loaded procedures:
89 readprofile | sort -nr +2 | head -20
90
91 Print only filesystem profile:
92 readprofile | grep _ext2
93
94 Look at all the kernel information, with ram addresses:
95 readprofile -av | less
96
97 Browse a `freezed' profile buffer for a non current kernel:
98 readprofile -p ~/profile.freeze -m /zImage.map.gz
99
100 Request profiling at 2kHz per CPU, and reset the profiling buffer:
101 sudo readprofile -M 20
102
104 readprofile only works with an 1.3.x or newer kernel, because
105 /proc/profile changed in the step from 1.2 to 1.3
106
107 This program only works with ELF kernels. The change for a.out kernels
108 is trivial, and left as an exercise to the a.out user.
109
110 To enable profiling, the kernel must be rebooted, because no profiling
111 module is available, and it wouldn't be easy to build. To enable pro‐
112 filing, you can specify "profile=2" (or another number) on the kernel
113 commandline. The number you specify is the two-exponent used as pro‐
114 filing step.
115
116 Profiling is disabled when interrupts are inhibited. This means that
117 many profiling ticks happen when interrupts are re-enabled. Watch out
118 for misleading information.
119
121 /proc/profile A binary snapshot of the profiling buffer.
122 /usr/src/linux/System.map The symbol table for the kernel.
123 /usr/src/linux/* The program being profiled :-)
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)