| 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 LTTng 0.4 on a linux 2.6.12-rc2-mm2 |
| 17 | kernel. Change the versions to fit your needs. |
| 18 | |
| 19 | Author : Mathieu Desnoyers, September 2005 |
| 20 | |
| 21 | |
| 22 | |
| 23 | *********************************************************** |
| 24 | ** Section 1 * Installation from Debian or RPM packages ** |
| 25 | *********************************************************** |
| 26 | |
| 27 | No Debian or RPM packages are ready yet. |
| 28 | |
| 29 | TODO |
| 30 | |
| 31 | |
| 32 | *********************************************************** |
| 33 | ** Section 2 * Installation from sources ** |
| 34 | *********************************************************** |
| 35 | |
| 36 | * Getting the LTTng packages |
| 37 | |
| 38 | su - |
| 39 | mkdir /usr/src/lttng |
| 40 | cd /usr/src/lttng |
| 41 | (see http://ltt.polymtl.ca/lttng for package listing) |
| 42 | wget http://ltt.polymtl.ca/lttng/lttng-modules-0.2.tar.bz2 |
| 43 | wget http://ltt.polymtl.ca/lttng/patch-2.6.12-rc4-mm2-lttng-0.4.bz2 |
| 44 | bzip2 -cd lttng-modules-0.2.tar.bz2 | tar xvof - |
| 45 | |
| 46 | |
| 47 | * Getting LTTng kernel sources |
| 48 | |
| 49 | su - |
| 50 | cd /usr/src |
| 51 | wget http://kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.12-rc4.tar.bz2 |
| 52 | 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 |
| 53 | bzip2 -cd linux-2.6.12-rc4.tar.bz2 | tar xvof - |
| 54 | cd linux-2.6.12-rc4 |
| 55 | bzip2 -cd ../2.6.12-rc4-mm2.bz2 | patch -p1 |
| 56 | bzip2 -cd /usr/src/lttng/patch-2.6.12-rc4-mm2-lttng-0.4.bz2 | patch -p1 |
| 57 | cd .. |
| 58 | mv linux-2.6.12-rc4 linux-2.6.12-rc4-mm2-lttng-0.4 |
| 59 | |
| 60 | |
| 61 | * Installing a LTTng kernel |
| 62 | |
| 63 | su - |
| 64 | cd /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4 |
| 65 | make menuconfig |
| 66 | General setup |
| 67 | * Linux Trace Toolkit Instrumentation Support |
| 68 | M or * Linux Trace Toolkit Tracer |
| 69 | do NOT activate (not ready yet) : |
| 70 | Align Linux Trace Toolkit Traces |
| 71 | Activate Linux Trace Toolkit Heartbeat Timer |
| 72 | IMPORTANT : This is enabled by default : you must disable it! |
| 73 | make |
| 74 | make install |
| 75 | make modules_install |
| 76 | |
| 77 | The first time you use relayfs, you have to specify a mount point in you system: |
| 78 | mkdir /mnt/relayfs |
| 79 | echo "relayfs /mnt/relayfs relayfs rw 0 0" \ |
| 80 | >> /etc/fstab |
| 81 | |
| 82 | Depending on your boot loader, you may want to execute : |
| 83 | update-grub or lilo |
| 84 | |
| 85 | reboot |
| 86 | |
| 87 | |
| 88 | * Install the ltt-modules |
| 89 | |
| 90 | su - |
| 91 | cd /usr/src/lttng/lttng-modules-0.2 |
| 92 | KERNELDIR=/usr/src/linux-2.6.12-rc4-mm2-lttng-0.4 make |
| 93 | KERNELDIR=/usr/src/linux-2.6.12-rc4-mm2-lttng-0.4 make modules_install |
| 94 | |
| 95 | note : at this stage, you might want to execute |
| 96 | modprobe ltt-control |
| 97 | |
| 98 | and you might also want to do this : |
| 99 | echo ltt-control >> /etc/modules |
| 100 | |
| 101 | |
| 102 | * Getting and installing the LTTV package |
| 103 | |
| 104 | su - |
| 105 | cd /usr/src |
| 106 | wget http://ltt.polymtl.ca/packages/LinuxTraceToolkitViewer-0.6.4-21092005.tar.gz |
| 107 | gzip -cd LinuxTraceToolkitViewer-0.6.4-21092005.tar.gz | tar xvof - |
| 108 | cd LinuxTraceToolkitViewer-0.6.4-21092005 |
| 109 | (refer to README to see the development libraries that must be installed on you |
| 110 | system) |
| 111 | ./configure |
| 112 | make |
| 113 | make install |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | *********************************************************** |
| 119 | ** Section 3 * Using LTTng and LTTV ** |
| 120 | *********************************************************** |
| 121 | |
| 122 | * Use graphical LTTV to control tracing and analyse traces |
| 123 | |
| 124 | lttv-gui (or /usr/local/bin/lttv-gui) |
| 125 | - Spot the "Tracing Control" icon : click on it |
| 126 | (it's a traffic light icon) |
| 127 | - enter the root password |
| 128 | - click "start" |
| 129 | - click "stop" |
| 130 | - Yes |
| 131 | * You should now see a trace |
| 132 | |
| 133 | * Use text mode LTTng to control tracing |
| 134 | |
| 135 | The tracing can be controlled from a terminal by using the lttctl command (as |
| 136 | root). |
| 137 | |
| 138 | Start tracing : |
| 139 | |
| 140 | lttctl -n trace -d -l /mnt/relayfs/ltt -t /tmp/trace |
| 141 | |
| 142 | Stop tracing and destroy trace channels : |
| 143 | |
| 144 | lttctl -n trace -R |
| 145 | |
| 146 | see lttctl --help for details. |
| 147 | |
| 148 | |
| 149 | * Use text mode LTTV |
| 150 | |
| 151 | Fell free to look in /usr/local/lib/lttv/plugins to see all the text and |
| 152 | graphical plugins available. |
| 153 | |
| 154 | For example, a simple trace dump in text format is available with : |
| 155 | |
| 156 | lttv -m textDump -t /tmp/trace |
| 157 | |
| 158 | see lttv -m textDump --help for detailed command line options of textDump. |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | *********************************************************** |
| 164 | ** Section 4 * Adding new instrumentations with genevent ** |
| 165 | *********************************************************** |
| 166 | |
| 167 | * Getting and installing genevent |
| 168 | |
| 169 | su - |
| 170 | cd /usr/src |
| 171 | wget http://ltt.polymtl.ca/packages/genevent-0.1.tar.gz |
| 172 | gzip -cd genevent-0.1.tar.gz | tar xvof - |
| 173 | cd genevent-0.1 |
| 174 | make |
| 175 | make install |
| 176 | |
| 177 | |
| 178 | * Add new events to the kernel with genevent |
| 179 | |
| 180 | su - |
| 181 | cd /usr/local/share/LinuxTraceToolkitViewer/facilities |
| 182 | cp process.xml yourfacility.xml |
| 183 | * edit yourfacility.xml to fit your needs. |
| 184 | cd /tmp |
| 185 | /usr/local/bin/genevent /usr/local/share/LinuxTraceToolkitViewer/yourfacility.xml |
| 186 | cp ltt-facility-yourfacility.h ltt-facility-id-yourfacility.h \ |
| 187 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4/include/linux/ltt |
| 188 | cp ltt-facility-loader-yourfacility.c ltt-facility-loader-yourfacility.h \ |
| 189 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4/ltt |
| 190 | * edit the kernel file you want to instrument |
| 191 | - Add #include <linux/ltt/ltt-facility-yourfacility.h> at the beginning |
| 192 | of the file. |
| 193 | - Add a call to the tracing functions. See their names and parameters in |
| 194 | /usr/src/linux-2.6.12-rc4-mm2-lttng-0.4/include/linux/ltt/ltt-facility-yourfacility.h |
| 195 | |
| 196 | |
| 197 | |