bf4af5b1 |
1 | |
2 | QUICKSTART |
3 | |
4 | How to use LTTng and LTTV in a few lines : |
5 | |
6 | This document is made of four parts : The first one explains how to install |
7 | LTTng and LTTV from Debian and RPM binary packages, the second one explains how |
8 | to install LTTng and LTTV from sources and the third one describes the steps |
9 | to follow to trace a system and view it. The fourth and last part explains |
10 | briefly how to add a new trace point to the kernel. |
11 | |
12 | What you will typically want is to read sections 1 and 3 : install LTTng from |
13 | binary packages and use it. If there are no packages ready for your system, you |
14 | will have to install from sources (section 2) instead. |
15 | |
16 | These operations are made for installing the LTTng 0.4.2 tracer on a |
17 | linux 2.6.12-rc4-mm2 kernel. You will also find instructions for installtion of |
18 | LTTV 0.6.x : the Linux Trace Toolkit Viewer. |
19 | |
20 | At this point, the -mm tree of the kernel is used because it has RelayFS support |
21 | in it. In a nearby future, a vanilla kernel 2.6.14 will be used, as RelayFS has |
22 | been integrated in the linux 2.6.14-rc series. |
23 | |
24 | The following lttng patch is necessary to have the tracing hooks in the kernel. |
25 | The following ltt-control module controls the tracing. |
26 | |
27 | Required programs and librairies are assumed to be automatically installed in an |
28 | installation with Debian or RPM packages. In the case of an installation from |
29 | sources, the dependencies are listed. |
30 | |
31 | |
32 | ** Current development status ** |
33 | |
34 | LTTng : |
35 | supported architectures : |
36 | Intel Pentium (UP/SMP) with TSC |
37 | |
38 | LTTV : |
39 | supported architectures : |
40 | Intel i386 and better |
41 | PowerPC |
42 | |
43 | |
44 | |
45 | Author : Mathieu Desnoyers, September 2005 |
46 | |
47 | |
48 | |
49 | *********************************************************** |
50 | ** Section 1 * Installation from Debian or RPM packages ** |
51 | *********************************************************** |
52 | |
53 | * Install from RPM packages on Fedora Core 4 : |
54 | |
55 | Get LTTV RPM from : |
56 | |
57 | http://ltt.polymtl.ca/packages/fedora/RPMS |
58 | |
59 | LTTV RPM are ready. |
60 | |
61 | LTTng kernel and lttng-modules RPM are available for some architectures (i586, |
62 | i686). Feel free to help fix the spec files to have correct lttng-modules RPM |
63 | package. |
64 | |
65 | |
66 | * Install from Deb packages on Debian : |
67 | |
68 | You can use the ltt.polymtl.ca apt source to get LTTV for Debian : |
69 | |
70 | Add the following two sources to your /etc/apt/sources.list : |
71 | |
72 | deb http://ltt.polymtl.ca/packages/debian experimental main |
73 | deb-src http://ltt.polymtl.ca/packages/debian experimental main |
74 | |
75 | |
76 | * Install from precompiled binary packages (LTTV compiled only for i386, and |
77 | LTTng only for i686 smp), perform the following : |
78 | |
79 | su - |
80 | apt-get update |
81 | apt-get install lttv lttv-doc |
82 | apt-get install kernel-image-2.6.12-rc4-mm2-lttng-0.4.2 |
83 | apt-get install lttng-modules-modules-2.6.12-rc4-mm2-lttng-0.4.2 |
84 | * note : the packages are signed by myself. I am not considered a trusted |
85 | Debian source yet, so warnings are normal. |
86 | |
87 | Then, follow the section "Editing the system wide configuration" in section 2. |
88 | |
89 | * Create custom LTTV Debian packages |
90 | |
91 | Binary packages are only available for i386. If you want to create your own LTTV |
92 | packages for other platforms, do : |
93 | |
94 | su - |
95 | cd /usr/src |
96 | apt-get source lttv |
97 | cd lttv-0.6.9 |
98 | dpkg-buildpackage -rfakeroot |
99 | |
100 | You should then have your LTTV .deb files created for your architecture. |
101 | |
102 | * Create custom LTTng packages |
103 | |
104 | For building LTTng Debian packages : |
105 | |
106 | su - |
107 | apt-get install kernel-source-2.6.12-rc4-mm2-lttng-0.4.2 |
108 | cd /usr/src |
109 | bzip2 -cd kernel-source-2.6.12-rc4-mm2-lttng-0.4.2.tar.bz2 | tar xvof - |
110 | cd kernel-source-2.6.12-rc4-mm2-lttng-0.4.2 |
111 | make menuconfig (or xconfig or config) (customize your configuration) |
112 | make-kpkg kernel_image |
113 | |
114 | You will then see your freshly created .deb in /usr/src. Install it with |
115 | dpkg -i /usr/src/(image-name).deb |
116 | |
117 | You will also need to create a package for the lttng-modules : |
118 | |
119 | su - |
120 | cd /usr/src |
121 | apt-get source lttng-modules |
122 | cd kernel-source-2.6.12-rc4-mm2-lttng-0.4.2 |
123 | make-kpkg --added_modules /usr/src/lttng-modules-0.3 modules_image |
124 | |
125 | You will then see your freshly created .deb in /usr/src. Install it with |
126 | dpkg -i /usr/src/lttng-modules-modules-(your version).deb |
127 | |
128 | |
129 | Then, follow the section "Editing the system wide configuration" in section 2. |
130 | |
131 | |
132 | *********************************************************** |
133 | ** Section 2 * Installation from sources ** |
134 | *********************************************************** |
135 | |
136 | * Prerequisites |
137 | |
138 | Tools needed to follow the package download steps : |
139 | |
140 | o wget |
141 | o bzip2 |
142 | o gzip |
143 | o tar |
144 | |
145 | You have to install the standard development librairies and programs necessary |
146 | to compile a kernel : |
147 | |
148 | (from Documentation/Changes in the Linux kernel tree) |
149 | o Gnu C 2.95.3 # gcc --version |
150 | o Gnu make 3.79.1 # make --version |
151 | o binutils 2.12 # ld -v |
152 | o util-linux 2.10o # fdformat --version |
153 | o module-init-tools 0.9.10 # depmod -V |
154 | |
155 | You might also want to have libncurses5 to have the text mode kernel |
156 | configuration menu, but there are alternatives. |
157 | |
158 | Prerequisites for LTTV 0.6.x installation are : |
159 | |
160 | gcc 3.2 or better |
161 | gtk 2.4 or better development libraries |
162 | (Debian : libgtk2.0, libgtk2.0-dev) |
163 | (Fedora : gtk2, gtk2-devel) |
164 | note : For Fedora users : this might require at least core 3 from Fedora, |
165 | or you might have to compile your own GTK2 library. |
166 | glib 2.4 or better development libraries |
167 | (Debian : libglib2.0-0, libglib2.0-dev) |
168 | (Fedora : glib2, glib2-devel) |
169 | libpopt development libraries |
170 | (Debian : libpopt0, libpopt-dev) |
171 | (Fedora : popt) |
172 | libpango development libraries |
173 | (Debian : libpango1.0, libpango1.0-dev) |
174 | (Fedora : pango, pango-devel) |
175 | libc6 development librairies |
176 | (Debian : libc6, libc6-dev) |
177 | (Fedora : glibc, glibc) |
178 | |
179 | |
180 | * Getting the LTTng packages |
181 | |
182 | su - |
183 | mkdir /usr/src/lttng |
184 | cd /usr/src/lttng |
185 | (see http://ltt.polymtl.ca/lttng for package listing) |
186 | wget http://ltt.polymtl.ca/lttng/lttng-modules-0.3.tar.bz2 |
187 | wget http://ltt.polymtl.ca/lttng/patch-2.6.12-rc4-mm2-lttng-0.4.2.tar.bz2 |
188 | bzip2 -cd lttng-modules-0.3.tar.bz2 | tar xvof - |
189 | bzip2 -cd patch-2.6.12-rc4-mm2-lttng-0.4.2.tar.bz2 | tar xvof - |
190 | |
191 | |
192 | * Getting LTTng kernel sources |
193 | |
194 | su - |
195 | cd /usr/src |
196 | wget http://kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.12-rc4.tar.bz2 |
197 | wget http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.12-rc4/2.6.12-rc4-mm2/2.6.12-rc4-mm2.bz2 |
198 | bzip2 -cd linux-2.6.12-rc4.tar.bz2 | tar xvof - |
199 | cd linux-2.6.12-rc4 |
200 | bzip2 -cd ../2.6.12-rc4-mm2.bz2 | patch -p1 |
201 | cat /usr/src/lttng/patch-2.6.12-rc4-mm2-lttng-0.4.2-* | patch -p1 |
202 | cd .. |
203 | mv linux-2.6.12-rc4 linux-2.6.12-rc4-mm2-lttng-0.4.2 |
204 | |
205 | |
206 | * Installing a LTTng kernel |
207 | |
208 | su - |
209 | cd /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2 |
210 | make menuconfig (or make xconfig or make config) |
211 | Select the < Help > button if you are not familiar with kernel |
212 | configuration. |
213 | Items preceded by [*] means they has to be built into the kernel. |
214 | Items preceded by [M] means they has to be built as modules. |
215 | Items preceded by [ ] means they should be removed. |
216 | go to the "General setup" section |
217 | Select the following options : |
218 | [*] Linux Trace Toolkit Instrumentation Support |
219 | [M] or [*] Linux Trace Toolkit Tracer |
220 | It makes no difference for the rest of the procedure whether the Tracer |
221 | is compiled built-in or as a module. |
222 | do NOT activate (not ready yet) : |
223 | [ ] Align Linux Trace Toolkit Traces |
224 | [ ] Activate Linux Trace Toolkit Heartbeat Timer |
225 | IMPORTANT : This is enabled by default : you must disable it! |
226 | Select <Exit> |
227 | Select <Exit> |
228 | Select <Yes> |
229 | make |
230 | make modules_install |
231 | make install |
232 | |
233 | reboot |
234 | |
235 | Select the Linux 2.6.12-rc4-mm2-lttng-0.4.2 kernel in your boot loader. |
236 | |
237 | |
238 | * Install the ltt-modules |
239 | |
240 | su - |
241 | cd /usr/src/lttng/lttng-modules-0.3 |
242 | KERNELDIR=/usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2 make |
243 | KERNELDIR=/usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2 make modules_install |
244 | |
245 | |
246 | * Editing the system wide configuration |
247 | |
248 | You must activate relayfs and specify a mount point. This is typically done in |
249 | fstab such that it happens at boot time. |
250 | |
251 | If you have never used RelayFS before, these operation would do this for you : |
252 | |
253 | mkdir /mnt/relayfs |
254 | cp /etc/fstab /etc/fstab.lttng.bkp |
255 | echo "relayfs /mnt/relayfs relayfs rw 0 0" >> /etc/fstab |
256 | |
257 | then, rebooting or issuing the following command will activate relayfs : |
258 | |
259 | mount /mnt/relayfs |
260 | |
261 | You need to load the ltt-control module to be able to control tracing from user |
262 | space. This is done by issuing the command : |
263 | |
264 | modprobe ltt-control |
265 | |
266 | You can automate at boot time loading the ltt-control module by : |
267 | |
268 | echo ltt-control >> /etc/modules |
269 | |
270 | |
271 | * Getting and installing the LTTV package |
272 | |
273 | su - |
274 | cd /usr/src |
275 | wget http://ltt.polymtl.ca/packages/LinuxTraceToolkitViewer-0.6.9-10102005.tar.gz |
276 | gzip -cd LinuxTraceToolkitViewer-0.6.9-10102005.tar.gz | tar xvof - |
277 | cd LinuxTraceToolkitViewer-0.6.9-10102005 |
278 | (refer to README to see the development libraries that must be installed on you |
279 | system) |
280 | ./configure |
281 | make |
282 | make install |
283 | |
284 | |
285 | |
286 | |
287 | *********************************************************** |
288 | ** Section 3 * Using LTTng and LTTV ** |
289 | *********************************************************** |
290 | |
291 | * Use graphical LTTV to control tracing and analyse traces |
292 | |
293 | lttv-gui (or /usr/local/bin/lttv-gui) |
294 | - Spot the "Tracing Control" icon : click on it |
295 | (it's a traffic light icon) |
296 | - enter the root password |
297 | - click "start" |
298 | - click "stop" |
299 | - Yes |
300 | * You should now see a trace |
301 | |
302 | * Use text mode LTTng to control tracing |
303 | |
304 | The tracing can be controlled from a terminal by using the lttctl command (as |
305 | root). |
306 | |
307 | Start tracing : |
308 | |
309 | lttctl -n trace -d -l /mnt/relayfs/ltt -t /tmp/trace |
310 | |
311 | Stop tracing and destroy trace channels : |
312 | |
313 | lttctl -n trace -R |
314 | |
315 | see lttctl --help for details. |
316 | |
317 | |
318 | * Use text mode LTTV |
319 | |
320 | Fell free to look in /usr/local/lib/lttv/plugins to see all the text and |
321 | graphical plugins available. |
322 | |
323 | For example, a simple trace dump in text format is available with : |
324 | |
325 | lttv -m textDump -t /tmp/trace |
326 | |
327 | see lttv -m textDump --help for detailed command line options of textDump. |
328 | |
329 | |
330 | |
331 | |
332 | *********************************************************** |
333 | ** Section 4 * Adding new instrumentations with genevent ** |
334 | *********************************************************** |
335 | |
336 | * Getting and installing genevent |
337 | |
338 | su - |
339 | cd /usr/src |
340 | wget http://ltt.polymtl.ca/packages/genevent-0.2.tar.gz |
341 | gzip -cd genevent-0.2.tar.gz | tar xvof - |
342 | cd genevent-0.2 |
343 | make |
344 | make install |
345 | |
346 | |
347 | * Add new events to the kernel with genevent |
348 | |
349 | su - |
350 | cd /usr/local/share/LinuxTraceToolkitViewer/facilities |
351 | cp process.xml yourfacility.xml |
352 | * edit yourfacility.xml to fit your needs. |
353 | cd /tmp |
354 | /usr/local/bin/genevent /usr/local/share/LinuxTraceToolkitViewer/yourfacility.xml |
355 | cp ltt-facility-yourfacility.h ltt-facility-id-yourfacility.h \ |
356 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2/include/linux/ltt |
357 | cp ltt-facility-loader-yourfacility.c ltt-facility-loader-yourfacility.h \ |
358 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2/ltt |
359 | * edit the kernel file you want to instrument |
360 | - Add #include <linux/ltt/ltt-facility-yourfacility.h> at the beginning |
361 | of the file. |
362 | - Add a call to the tracing functions. See their names and parameters in |
363 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4.2/include/linux/ltt/ltt-facility-yourfacility.h |
364 | |
365 | |
366 | |