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