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