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