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