| 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.5.3 tracer on a |
| 17 | linux 2.6.15 kernel. You will also find instructions for installation of |
| 18 | LTTV 0.8.x : the Linux Trace Toolkit Viewer. |
| 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 | |
| 27 | |
| 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 |
| 37 | Intel 64 bits |
| 38 | PowerPC |
| 39 | |
| 40 | |
| 41 | |
| 42 | Author : Mathieu Desnoyers, September 2005 |
| 43 | Last update : January 10, 2006 |
| 44 | |
| 45 | |
| 46 | *********************************************************** |
| 47 | ** Section 1 * Installation from Debian or RPM packages ** |
| 48 | *********************************************************** |
| 49 | |
| 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 | |
| 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 | |
| 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. |
| 66 | |
| 67 | |
| 68 | * Install from Deb packages on Debian : |
| 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 | |
| 77 | |
| 78 | * Install from precompiled binary packages (LTTV compiled only for i386, and |
| 79 | LTTng only for i686 smp), perform the following : |
| 80 | |
| 81 | su - |
| 82 | apt-get update |
| 83 | apt-get install lttv lttv-doc |
| 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 |
| 86 | * note : the packages are signed by myself. I am not considered a trusted |
| 87 | Debian source yet, so warnings are normal. |
| 88 | |
| 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 : |
| 95 | |
| 96 | su - |
| 97 | cd /usr/src |
| 98 | apt-get source lttv |
| 99 | cd lttv-0.6.9 |
| 100 | dpkg-buildpackage -rfakeroot |
| 101 | |
| 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 - |
| 109 | apt-get install kernel-source-2.6.12-rc4-mm2-lttng-0.4.2 |
| 110 | cd /usr/src |
| 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 |
| 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 |
| 124 | cd kernel-source-2.6.12-rc4-mm2-lttng-0.4.2 |
| 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 | |
| 130 | |
| 131 | Then, follow the section "Editing the system wide configuration" in section 2. |
| 132 | |
| 133 | |
| 134 | *********************************************************** |
| 135 | ** Section 2 * Installation from sources ** |
| 136 | *********************************************************** |
| 137 | |
| 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 | |
| 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) |
| 180 | |
| 181 | |
| 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) |
| 188 | wget http://ltt.polymtl.ca/lttng/lttng-modules-0.4.tar.bz2 |
| 189 | wget http://ltt.polymtl.ca/lttng/patch-2.6.15-lttng-0.5.3.tar.bz2 |
| 190 | bzip2 -cd lttng-modules-0.4.tar.bz2 | tar xvof - |
| 191 | bzip2 -cd patch-2.6.15-lttng-0.5.3.tar.bz2 | tar xvof - |
| 192 | |
| 193 | |
| 194 | * Getting LTTng kernel sources |
| 195 | |
| 196 | su - |
| 197 | cd /usr/src |
| 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 |
| 201 | cat /usr/src/lttng/patch-2.6.15-lttng-0.5.3* | patch -p1 |
| 202 | cd .. |
| 203 | mv linux-2.6.15 linux-2.6.15-lttng-0.5.3 |
| 204 | |
| 205 | |
| 206 | * Installing a LTTng kernel |
| 207 | |
| 208 | su - |
| 209 | cd /usr/src/linux-2.6.15-lttng-0.5.3 |
| 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 "Instrumentation Support" 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 | activate : |
| 223 | [*] Align Linux Trace Toolkit Traces |
| 224 | do NOT activate (not ready yet) : |
| 225 | [ ] Activate Linux Trace Toolkit Heartbeat Timer |
| 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. |
| 231 | Select <Exit> |
| 232 | Select <Exit> |
| 233 | Select <Yes> |
| 234 | make |
| 235 | make modules_install |
| 236 | make install |
| 237 | |
| 238 | reboot |
| 239 | |
| 240 | Select the Linux 2.6.15-lttng-0.5.3 kernel in your boot loader. |
| 241 | |
| 242 | |
| 243 | * Install the ltt-modules |
| 244 | |
| 245 | su - |
| 246 | cd /usr/src/lttng/lttng-modules-0.4 |
| 247 | KERNELDIR=/usr/src/linux-2.6.15-lttng-0.5.3 make |
| 248 | KERNELDIR=/usr/src/linux-2.6.15-lttng-0.5.3 make modules_install |
| 249 | |
| 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 | |
| 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 : |
| 268 | |
| 269 | modprobe ltt-control |
| 270 | |
| 271 | You can automate at boot time loading the ltt-control module by : |
| 272 | |
| 273 | echo ltt-control >> /etc/modules |
| 274 | |
| 275 | |
| 276 | * Getting and installing the LTTV package |
| 277 | |
| 278 | su - |
| 279 | cd /usr/src |
| 280 | wget http://ltt.polymtl.ca/packages/LinuxTraceToolkitViewer-0.8.3-06012006.tar.gz |
| 281 | gzip -cd LinuxTraceToolkitViewer-0.8.3-06012006.tar.gz | tar xvof - |
| 282 | cd LinuxTraceToolkitViewer-0.8.3-06012006 |
| 283 | (refer to README to see the development libraries that must be installed on you |
| 284 | system) |
| 285 | ./configure |
| 286 | make |
| 287 | make install |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | *********************************************************** |
| 293 | ** Section 3 * Using LTTng and LTTV ** |
| 294 | *********************************************************** |
| 295 | |
| 296 | * Use graphical LTTV to control tracing and analyse traces |
| 297 | |
| 298 | lttv-gui (or /usr/local/bin/lttv-gui) |
| 299 | - Spot the "Tracing Control" icon : click on it |
| 300 | (it's a traffic light icon) |
| 301 | - enter the root password |
| 302 | - click "start" |
| 303 | - click "stop" |
| 304 | - Yes |
| 305 | * You should now see a trace |
| 306 | |
| 307 | * Use text mode LTTng to control tracing |
| 308 | |
| 309 | The tracing can be controlled from a terminal by using the lttctl command (as |
| 310 | root). |
| 311 | |
| 312 | Start tracing : |
| 313 | |
| 314 | lttctl -n trace -d -l /mnt/relayfs/ltt -t /tmp/trace |
| 315 | |
| 316 | Stop tracing and destroy trace channels : |
| 317 | |
| 318 | lttctl -n trace -R |
| 319 | |
| 320 | see lttctl --help for details. |
| 321 | |
| 322 | |
| 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 | *********************************************************** |
| 340 | |
| 341 | * Getting and installing genevent |
| 342 | |
| 343 | su - |
| 344 | cd /usr/src |
| 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 |
| 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 |
| 359 | /usr/local/bin/genevent /usr/local/share/LinuxTraceToolkitViewer/facilities/yourfacility.xml |
| 360 | cp ltt-facility-yourfacility.h ltt-facility-id-yourfacility.h \ |
| 361 | /usr/src/linux-2.6.15-lttng-0.5.3/include/linux/ltt |
| 362 | cp ltt-facility-loader-yourfacility.c ltt-facility-loader-yourfacility.h \ |
| 363 | /usr/src/linux-2.6.15-lttng-0.5.3/ltt |
| 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 |
| 368 | /usr/src/linux-2.6.15-lttng-0.5.3/include/linux/ltt/ltt-facility-yourfacility.h |
| 369 | |
| 370 | |
| 371 | |