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. This is supported on i386-SMP
51 (2.2 and 2.4 kernel) and also on sparc-SMP and sparc64-SMP (2.4
52 kernel). This option also resets the profiling buffer, and
53 requires superuser privileges.
54
55 -p, --profile pro-file
56 Specify a different profiling buffer, which by default is
57 /proc/profile. Using a different pro-file is useful if you want
58 to `freeze' the kernel profiling at some time and read it later.
59 The /proc/profile file can be copied using `cat' or `cp'. There
60 is no more support for compressed profile buffers, like in read‐
61 profile-1.1, because the program needs to know the size of the
62 buffer in advance.
63
64 -r, --reset
65 Reset the profiling buffer. This can only be invoked by root,
66 because /proc/profile is readable by everybody but writable only
67 by the superuser. However, you can make readprofile setuid 0,
68 in order to reset the buffer without gaining privileges.
69
70 -s, --counters
71 Print individual counters within functions.
72
73 -v, --verbose
74 Verbose. The output is organized in four columns and filled
75 with blanks. The first column is the RAM address of a kernel
76 function, the second is the name of the function, the third is
77 the number of clock ticks and the last is the normalized load.
78
79 -V, --version
80 This makes readprofile print its version number and exit.
81
82 -h, --help
83 Display help and exit.
84
86 Browse the profiling buffer ordering by clock ticks:
87 readprofile | sort -nr | less
88
89 Print the 20 most loaded procedures:
90 readprofile | sort -nr +2 | head -20
91
92 Print only filesystem profile:
93 readprofile | grep _ext2
94
95 Look at all the kernel information, with ram addresses:
96 readprofile -av | less
97
98 Browse a `freezed' profile buffer for a non current kernel:
99 readprofile -p ~/profile.freeze -m /zImage.map.gz
100
101 Request profiling at 2kHz per CPU, and reset the profiling buffer:
102 sudo readprofile -M 20
103
105 readprofile only works with an 1.3.x or newer kernel, because
106 /proc/profile changed in the step from 1.2 to 1.3
107
108 This program only works with ELF kernels. The change for a.out kernels
109 is trivial, and left as an exercise to the a.out user.
110
111 To enable profiling, the kernel must be rebooted, because no profiling
112 module is available, and it wouldn't be easy to build. To enable pro‐
113 filing, you can specify "profile=2" (or another number) on the kernel
114 commandline. The number you specify is the two-exponent used as pro‐
115 filing step.
116
117 Profiling is disabled when interrupts are inhibited. This means that
118 many profiling ticks happen when interrupts are re-enabled. Watch out
119 for misleading information.
120
122 /proc/profile A binary snapshot of the profiling buffer.
123 /usr/src/linux/System.map The symbol table for the kernel.
124 /usr/src/linux/* The program being profiled :-)
125
127 The readprofile command is part of the util-linux package and is avail‐
128 able from Linux Kernel Archive ⟨ftp://ftp.kernel.org/pub/linux/utils
129 /util-linux/⟩.
130
131
132
133util-linux October 2011 READPROFILE(8)