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