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