update features
[lttv.git] / trunk / lttv / QUICKSTART.html
CommitLineData
c924c2c6 1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
bc58079d 4 <title>Linux Trace Toolkit Next Generation User Documentation</title>
c924c2c6 5</head>
6 <body>
7
bc58079d 8<h1>Linux Trace Toolkit Next Generation User Documentation</h1>
c924c2c6 9
c924c2c6 10Author : Mathieu Desnoyers, September 2005<br>
24070967 11Last update : January 21st, 2009<br>
bc58079d 12(originally known as the LTTng QUICKSTART guide)
24070967 13
14<h2>Table of Contents</h2>
15<ul>
16
f9ff56f3 17<li><a href="#intro" name="TOCintro">Introduction</a></li>
24070967 18<li><a href="#section1" name="TOCsection1">Installing LTTng and LTTV from
6f88b01d 19sources</a></li>
38b04cd7 20<ul>
2d540155 21<li><a href="#prerequisites" name="TOCprerequisites">Prerequisistes</li>
22<li><a href="#getlttng" name="TOCgetlttng">Getting the LTTng packages</li>
23<li><a href="#getlttngsrc" name="TOCgetlttngsrc">Getting the LTTng kernel sources</li>
24<li><a href="#installlttng" name="TOCinstalllttng">Installing a LTTng kernel</li>
6f88b01d 25<li><a href="#editconfig" name="TOCeditconfig">Editing the system wide
26configuration</a>
27<li><a href="#getlttctl" name="TOCgetlttctl">Getting and installing the
2d540155 28ltt-control package</li>
29<li><a href="#userspacetracing" name="TOCuserspacetracing">Userspace Tracing</li>
6f88b01d 30<li><a href="#getlttv" name="TOCgetlttv">Getting and installing the LTTV package</ul>
24070967 31<li><a href="#section2" name="TOCsection2">Using LTTng and LTTV</a></li>
32<li><a href="#section3" name="TOCsection3">Adding kernel and user-space
33tracepoints</a></li>
633bc4a3 34<li><a href="#section4" name="TOCsection4">Creating Debian and RPM packages
35from LTTV</a>
c924c2c6 36
f9ff56f3 37</ul>
38
39<hr />
40
b9e1fab1 41<h2><a href="#TOCintro" name="intro">Introduction</a></h2>
c924c2c6 42<p>
633bc4a3 43This document is made of four parts : the first one explains how
24070967 44to install LTTng and LTTV from sources, the second one describes the steps
633bc4a3 45to follow to trace a system and view it. The third part explains
c924c2c6 46briefly how to add a new trace point to the kernel and to user space
633bc4a3 47applications. The fourth and last part explains how to create Debian or RPM
48packages from the LTTng and LTTV sources.
c924c2c6 49<p>
24070967 50These operations are made for installing the LTTng 0.86 tracer on a linux 2.6.X
c924c2c6 51kernel. You will also find instructions for installation of LTTV 0.12.x : the
52Linux Trace Toolkit Viewer.
24070967 53To see the list of compatibilities between LTTng, ltt-control, LTTV, please
54refer to :
c924c2c6 55<a
56href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/lttng-lttv-compatibility.html">LTTng+LTTV versions compatibility</a>
24070967 57The lttng patch is necessary to have the tracing hooks in the kernel.
c924c2c6 58
24070967 59<br>
60<br>
633bc4a3 61Supported architectures :
6f88b01d 62br>
c924c2c6 63LTTng :<br>
c924c2c6 64<li> x86 32/64 bits
65<li> PowerPC 32 and 64 bits
66<li> ARM (with limited timestamping precision, e.g. 1HZ. Need
67architecture-specific support for better precision)
68<li> MIPS
69<br>
24070967 70<br>
c924c2c6 71LTTV :<br>
c924c2c6 72<li> Intel 32/64 bits
73<li> PowerPC 32 and 64 bits
74<li> Possibly others. Takes care of endianness and type size difference between
75the LTTng traces and the LTTV analysis tool.
76
f9ff56f3 77<hr />
78
c924c2c6 79
89aa576c 80<h2><a href="#TOCsection1" name="section1">Installation from sources</a></h2>
633bc4a3 81<p>
c924c2c6 82
6f88b01d 83<h3><a href="#TOCprerequisites" name="prerequisites">Prerequisites</a></h3>
633bc4a3 84<ul>
85<p>
c924c2c6 86Tools needed to follow the package download steps :
87
633bc4a3 88<li>wget
89<li>bzip2
90<li>gzip
91<li>tar
c924c2c6 92
633bc4a3 93<p>
c924c2c6 94You have to install the standard development libraries and programs necessary
95to compile a kernel :
96
84cf5903 97<PRE>
c924c2c6 98(from Documentation/Changes in the Linux kernel tree)
84cf5903 99Gnu C 2.95.3 # gcc --version
100Gnu make 3.79.1 # make --version
101binutils 2.12 # ld -v
102util-linux 2.10o # fdformat --version
103module-init-tools 0.9.10 # depmod -V
104</PRE>
c924c2c6 105
633bc4a3 106<p>
c924c2c6 107You might also want to have libncurses5 to have the text mode kernel
108configuration menu, but there are alternatives.
109
633bc4a3 110<p>
c924c2c6 111Prerequisites for LTTV 0.x.x installation are :
112
84cf5903 113<PRE>
114gcc 3.2 or better
115gtk 2.4 or better development libraries
c924c2c6 116 (Debian : libgtk2.0, libgtk2.0-dev)
117 (Fedora : gtk2, gtk2-devel)
118 note : For Fedora users : this might require at least core 3 from Fedora,
119 or you might have to compile your own GTK2 library.
84cf5903 120glib 2.4 or better development libraries
c924c2c6 121 (Debian : libglib2.0-0, libglib2.0-dev)
122 (Fedora : glib2, glib2-devel)
84cf5903 123libpopt development libraries
c924c2c6 124 (Debian : libpopt0, libpopt-dev)
125 (Fedora : popt)
84cf5903 126libpango development libraries
c924c2c6 127 (Debian : libpango1.0, libpango1.0-dev)
128 (Fedora : pango, pango-devel)
84cf5903 129libc6 development librairies
c924c2c6 130 (Debian : libc6, libc6-dev)
131 (Fedora : glibc, glibc)
84cf5903 132</PRE>
633bc4a3 133</ul>
c924c2c6 134
c8997124 135<li>Reminder</li>
c924c2c6 136
c8997124 137<p>
633bc4a3 138See the list of compatibilities between LTTng, ltt-control and LTTV at :
139<a
140href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/lttng-lttv-compatibility.html">LTTng+LTTV
141versions compatibility</a>.
c924c2c6 142
143
6f88b01d 144<h3><a href="#TOCgetlttng" name="getlttng">Getting the LTTng packages</a></h3>
c924c2c6 145
c8997124 146<PRE>
c924c2c6 147su -
148mkdir /usr/src/lttng
149cd /usr/src/lttng
150(see http://ltt.polymtl.ca/lttng for package listing)
151wget http://ltt.polymtl.ca/lttng/patch-2.6.X-lttng-0.x.xx.tar.bz2
152bzip2 -cd patch-2.6.X-lttng-0.x.xx.tar.bz2 | tar xvof -
c8997124 153</PRE>
c924c2c6 154
155
6f88b01d 156<h3><a href="#TOCgetlttngsrc" name="getlttngsrc">Getting LTTng kernel sources</a></h3>
c924c2c6 157
c8997124 158<PRE>
c924c2c6 159su -
160cd /usr/src
161wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.X.tar.bz2
162bzip2 -cd linux-2.6.X.tar.bz2 | tar xvof -
163cd linux-2.6.X
164- For LTTng 0.9.4- cat /usr/src/lttng/patch*-2.6.X-lttng-0.x.xx* | patch -p1
165- For LTTng 0.9.5+ apply the patches in the order specified in the series file,
166 or use quilt
167cd ..
168mv linux-2.6.X linux-2.6.X-lttng-0.x.xx
c8997124 169</PRE>
c924c2c6 170
171
6f88b01d 172<h3><a href="#TOCinstalllttng" name="installlttng">Installing a LTTng kernel</a></h3>
c924c2c6 173
c8997124 174<PRE>
c924c2c6 175su -
176cd /usr/src/linux-2.6.X-lttng-0.x.xx
177make menuconfig (or make xconfig or make config)
178 Select the < Help > button if you are not familiar with kernel
179 configuration.
180 Items preceded by [*] means they has to be built into the kernel.
181 Items preceded by [M] means they has to be built as modules.
182 Items preceded by [ ] means they should be removed.
183 go to the "General setup" section
184 Select the following options :
185 [*] Prompt for development and/or incomplete code/drivers
186 [*] Activate markers
187 [*] Activate userspace markers ABI (experimental, optional)
188 [*] Immediate value optimization (optional)
189 [*] Linux Trace Toolkit Next Generation (LTTng) --->
190 <M> or <*> Compile lttng tracing probes
191 <M> or <*> Linux Trace Toolkit High-speed Lockless Data Relay
192 <M> or <*> Linux Trace Toolkit Lock-Protected Data Relay
193 <M> or <*> Linux Trace Toolkit Serializer
194 <M> or <*> Linux Trace Toolkit Marker Control
195 <M> or <*> Linux Trace Toolkit Tracer
196 [*] Align Linux Trace Toolkit Traces
197 <M> or <*> Support logging events from userspace
198 [*] Support trace extraction from crash dump
199 <M> or <*> Linux Trace Toolkit Trace Controller
200 <M> or <*> Linux Trace Toolkit State Dump
201 Select <Exit>
202 Select <Exit>
203 Select <Yes>
204make
205make modules_install
206(if necessary, create a initrd with mkinitrd or your preferate alternative)
207(mkinitrd -o /boot/initrd.img-2.6.X-lttng-0.x.xx 2.6.X-lttng-0.x.xx)
208
209-- on X86, X86_64
210make install
211reboot
212Select the Linux 2.6.X-lttng-0.x.xx kernel in your boot loader.
213
214-- on PowerPC
215cp vmlinux.strip /boot/vmlinux-2.6.X-lttng-0.x.xx
216cp System.map /boot/System.map-2.6.X-lttng-0.x.xx
217cp .config /boot/config-2.6.X-lttng-0.x.xx
218depmod -ae -F /boot/System.map-2.6.X-lttng-0.x.xx 2.6.X-lttng-0.x.xx
219mkinitrd /boot/initrd.img-2.6.X-lttng-0.x.xx 2.6.X-lttng-0.x.xx
220(edit /etc/yaboot.conf to add a new entry pointing to your kernel : the entry
221that comes first is the default kernel)
222ybin
223select the right entry at the yaboot prompt (see choices : tab, select : type
224the kernel name followed by enter)
225Select the Linux 2.6.X-lttng-0.x.xx kernel in your boot loader.
226--
c8997124 227</PRE>
c924c2c6 228
6f88b01d 229<h3><a href="#TOCeditconfig" name="editconfig">Editing the system wide
230configuration</a></h3>
c924c2c6 231
c8997124 232<p>
c924c2c6 233You must activate debugfs and specify a mount point. This is typically done in
c8997124 234fstab such that it happens at boot time. If you have never used DebugFS before,
235these operation would do this for you :
c924c2c6 236
c8997124 237<PRE>
c924c2c6 238mkdir /mnt/debugfs
239cp /etc/fstab /etc/fstab.lttng.bkp
240echo "debugfs /mnt/debugfs debugfs rw 0 0" >> /etc/fstab
c8997124 241</PRE>
c924c2c6 242
c8997124 243<p>
c924c2c6 244then, rebooting or issuing the following command will activate debugfs :
c8997124 245<PRE>
c924c2c6 246mount /mnt/debugfs
c8997124 247</PRE>
c924c2c6 248
c8997124 249<p>
c924c2c6 250You need to load the LTT modules to be able to control tracing from user
251space. This is done by issuing the following commands. Note however
252these commands load all LTT modules. Depending on what options you chose to
253compile statically, you may not need to issue all these commands.
254
c8997124 255<PRE>
c924c2c6 256modprobe ltt-trace-control
257modprobe ltt-marker-control
258modprobe ltt-tracer
259modprobe ltt-serialize
260modprobe ltt-relay
261modprobe ipc-trace
262modprobe kernel-trace
263modprobe mm-trace
264modprobe net-trace
265modprobe fs-trace
266modprobe jbd2-trace
267modprobe ext4-trace
268modprobe syscall-trace
269modprobe trap-trace
270#if locking tracing is wanted, uncomment the following
271#modprobe lockdep-trace
c8997124 272</PRE>
c924c2c6 273
c8997124 274<p>
c924c2c6 275If you want to have complete information about the kernel state (including all
276the process names), you need to load the ltt-statedump module. This is done by
277issuing the command :
278
c8997124 279<PRE>
c924c2c6 280modprobe ltt-statedump
c8997124 281</PRE>
282<p>
c924c2c6 283You can automate at boot time loading the ltt-control module by :
284
c8997124 285<PRE>
c924c2c6 286cp /etc/modules /etc/modules.bkp
287echo ltt-trace-control >> /etc/modules
288echo ltt-marker-control >> /etc/modules
289echo ltt-tracer >> /etc/modules
290echo ltt-serialize >> /etc/modules
291echo ltt-relay >> /etc/modules
292echo ipc-trace >> /etc/modules
293echo kernel-trace >> /etc/modules
294echo mm-trace >> /etc/modules
295echo net-trace >> /etc/modules
296echo fs-trace >> /etc/modules
297echo jbd2-trace >> /etc/modules
298echo ext4-trace >> /etc/modules
299echo syscall-trace >> /etc/modules
300echo trap-trace >> /etc/modules
301#if locking tracing is wanted, uncomment the following
302#echo lockdep-trace >> /etc/modules
c8997124 303</PRE>
c924c2c6 304
6f88b01d 305
306<h3><a href="#TOCgetlttctl" name="getlttctl">Getting and installing the
307ltt-control package (on the traced machine)</a></h3>
c8997124 308<p>
c924c2c6 309(note : the ltt-control package contains lttd and lttctl. Although it has the
310same name as the ltt-control kernel module, they are *not* the same thing.)
c8997124 311
312<PRE>
c924c2c6 313su -
314cd /usr/src
315wget http://ltt.polymtl.ca/lttng/ltt-control-0.x-xxxx2006.tar.gz
316gzip -cd ltt-control-0.x-xxxx2008.tar.gz | tar xvof -
317cd ltt-control-0.x-xxxx2006
318(refer to README to see the development libraries that must be installed on you
319system)
320./configure
321make
322make install
c8997124 323</PRE>
c924c2c6 324
38b04cd7 325<h3><a href="#TOCuserspacetracing" name="userspacetracing">Userspace tracing</a></h3>
c924c2c6 326
c8997124 327<PRE>
c924c2c6 328Make sure you selected the kernel menuconfig option :
329 <M> or <*> Support logging events from userspace
330And that the ltt-userspace-event kernel module is loaded if selected as a
331module.
332
333Simple userspace tracing is available through
334echo "some text to record" > /mnt/debugfs/ltt/write_event
335
336It will appear in the trace under event :
337channel : userspace
338event name : event
c8997124 339</PRE>
c924c2c6 340
6f88b01d 341<h3><a href="#TOCgetlttv" name="getlttv">Getting and installing the LTTV package
342(on the visualisation machine, same
343or different from the visualisation machine)</a></h3>
c924c2c6 344
c8997124 345<PRE>
c924c2c6 346su -
347cd /usr/src
348wget http://ltt.polymtl.ca/packages/lttv-0.x.xx-xxxx2008.tar.gz
349gzip -cd lttv-0.x.xx-xxxx2008.tar.gz | tar xvof -
350cd lttv-0.x.xx-xxxx2008
351(refer to README to see the development libraries that must be installed on your
352system)
353./configure
354make
355make install
13d7a628 356</PRE>
c924c2c6 357
c8997124 358<hr />
c924c2c6 359
c924c2c6 360
89aa576c 361<h2><a href="#TOCsection2" name="section2">Using LTTng and LTTV</a></h2>
c924c2c6 362
c8997124 363<li>IMPORTANT : Arm Linux Kernel Markers after each boot</li>
c8997124 364<PRE>
c924c2c6 365ltt-armall
c8997124 366</PRE>
c924c2c6 367
c8997124 368<li>Use graphical LTTV to control tracing and analyse traces</li>
c8997124 369<PRE>
c924c2c6 370lttv-gui (or /usr/local/bin/lttv-gui)
371 - Spot the "Tracing Control" icon : click on it
372 (it's a traffic light icon)
373 - enter the root password
374 - click "start"
375 - click "stop"
376 - Yes
377 * You should now see a trace
c8997124 378</PRE>
c924c2c6 379
c8997124 380<li>Use text mode LTTng to control tracing</li>
c8997124 381<PRE>
c924c2c6 382The tracing can be controlled from a terminal by using the lttctl command (as
383root).
384
385Start tracing :
386
387lttctl -C -w /tmp/trace1 trace1
388
389Stop tracing and destroy trace channels :
390
391lttctl -D trace1
392
393see lttctl --help for details.
df7f63ab 394</PRE>
c8997124 395<p>
c924c2c6 396(note : to see if the buffers has been filled, look at the dmesg output after
397lttctl -R or after stopping tracing from the GUI, it will show an event lost
398count. If it is the case, try using larger buffers. See lttctl --help to learn
399how. lttv now also shows event lost messages in the console when loading a trace
400with missing events or lost subbuffers.)
401
c8997124 402<li>Use text mode LTTV</li>
c8997124 403<p>
c924c2c6 404Feel free to look in /usr/local/lib/lttv/plugins to see all the text and
405graphical plugins available.
c8997124 406<p>
c924c2c6 407For example, a simple trace dump in text format is available with :
c8997124 408<PRE>
c924c2c6 409lttv -m textDump -t /tmp/trace
c8997124 410</PRE>
c8997124 411<p>
412See lttv -m textDump --help for detailed command line options of textDump.
c8997124 413<p>
c924c2c6 414It is, in the current state of the project, very useful to use "grep" on the
415text output to filter by specific event fields. You can later copy the timestamp
416of the events to the clipboard and paste them in the GUI by clicking on the
417bottom right label "Current time". Support for this type of filtering should
418be added to the filter module soon.
419
c8997124 420<li>Hybrid mode</li>
c8997124 421<p>
c924c2c6 422Starting from LTTng 0.5.105 and ltt-control 0.20, a new mode can be used :
423hybrid. It can be especially useful when studying big workloads on a long period
424of time.
c8997124 425<p>
c924c2c6 426When using this mode, the most important, low rate control information will be
427recorded during all the trace by lttd (i.e. process creation/exit). The high
428rate information (i.e. interrupt/traps/syscall entry/exit) will be kept in a
429flight recorder buffer (now named flight-channelname_X).
c8997124 430<p>
c924c2c6 431The following lttctl commands take an hybrid trace :
c8997124 432<p>
c924c2c6 433Create trace channel, start lttd on normal channels, start tracing:
c8997124 434<PRE>
c924c2c6 435lttctl -C -w /tmp/trace2 -o channel.kernel.overwrite=1 trace2
c8997124 436</PRE>
437<p>
c924c2c6 438Stop tracing, start lttd on flight recorder channels, destroy trace channels :
c8997124 439<PRE>
c924c2c6 440lttctl -D -w /tmp/trace2 trace2
c8997124 441</PRE>
442<p>
c924c2c6 443Each "overwrite" channel is flight recorder channel.
444
c8997124 445<li>Flight recorder mode</li>
c8997124 446<p>
c924c2c6 447The flight recorder mode writes data into overwritten buffers for all channels,
448including control channels, except for the facilities tracefiles. It consists of
449setting all channels to "overwrite".
c8997124 450<p>
c924c2c6 451The following lttctl commands take a flight recorder trace :
c8997124 452<PRE>
c924c2c6 453lttctl -C -w /tmp/trace3 -o channel.all.overwrite=1 trace3
454...
455lttctl -D -w /tmp/trace3 trace3
c8997124 456</PRE>
c924c2c6 457
89aa576c 458<hr />
459
460
461<h2><a href="#TOCsection3" name="section3">Adding new instrumentations with the
462markers</a></h2>
463<p>
c924c2c6 464
89aa576c 465<p>
c924c2c6 466See Documentation/markers.txt and Documentation/tracepoints.txt in your kernel
467tree.
468
2e4e30d7 469<li>Add new events to userspace programs with
470<a href="http://ltt.polymtl.ca/packages/">userspace markers packages</a></li>
c924c2c6 471
89aa576c 472<p>
c924c2c6 473Get the latest markers-userspace-*.tar.bz2 and see the Makefile and examples. It
474allows inserting markers in executables and libraries, currently only on x86_32
475and x86_64.
e01a1ce1 476See <a
477href="http://ltt.polymtl.ca/packages/markers-userspace-0.5.tar.bz2">markers-userspace-0.5.tar.bz2</a> or more recent.
478
38b04cd7 479<p>
e01a1ce1 480Note that a new design document for a 3rd generation of tracepoint/marker-based
481userspace tracing is available at <a
482href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/ust.html">LTTng User-space Tracing
38b04cd7 483Design"</a>. This new infrastructure is not yet implemented.
484
485<p>
486The easy quick-and-dirty way to perform userspace tracing is currently to write
487an string to /mnt/debugfs/ltt/write_event. See <a
488href="#userspacetracing">Userspace tracing</a> in the
489installation for sources section of this document.
e01a1ce1 490
89aa576c 491<hr />
633bc4a3 492
89aa576c 493<h2><a href="#TOCsection4" name="section4">Creating Debian or RPM packages</a></h2>
494<p>
633bc4a3 495
89aa576c 496<li>Create custom LTTV Debian packages</li>
633bc4a3 497
89aa576c 498<PRE>
499Use : dpkg-buildpackage -rfakeroot
500</PRE>
501<p>
633bc4a3 502You should then have your LTTV .deb files created for your architecture.
503
89aa576c 504<li>Create custom LTTng packages</li>
505<p>
633bc4a3 506For building LTTng Debian packages :
89aa576c 507get the build tree with patches applies as explained in section 2.
633bc4a3 508
89aa576c 509<PRE>
633bc4a3 510make menuconfig (or xconfig or config) (customize your configuration)
511make-kpkg kernel_image
89aa576c 512</PRE>
513<p>
633bc4a3 514You will then see your freshly created .deb in /usr/src. Install it with
89aa576c 515<PRE>
633bc4a3 516dpkg -i /usr/src/(image-name).deb
89aa576c 517</PRE>
518<p>
633bc4a3 519Then, follow the section "Editing the system wide configuration" in section 2.
520
521
522
c924c2c6 523 </body>
524</html>
This page took 0.04838 seconds and 4 git commands to generate.