update features
[lttv.git] / trunk / lttv / QUICKSTART.html
... / ...
CommitLineData
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4 <title>Linux Trace Toolkit Next Generation User Documentation</title>
5</head>
6 <body>
7
8<h1>Linux Trace Toolkit Next Generation User Documentation</h1>
9
10Author : Mathieu Desnoyers, September 2005<br>
11Last update : January 21st, 2009<br>
12(originally known as the LTTng QUICKSTART guide)
13
14<h2>Table of Contents</h2>
15<ul>
16
17<li><a href="#intro" name="TOCintro">Introduction</a></li>
18<li><a href="#section1" name="TOCsection1">Installing LTTng and LTTV from
19sources</a></li>
20<ul>
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>
25<li><a href="#editconfig" name="TOCeditconfig">Editing the system wide
26configuration</a>
27<li><a href="#getlttctl" name="TOCgetlttctl">Getting and installing the
28ltt-control package</li>
29<li><a href="#userspacetracing" name="TOCuserspacetracing">Userspace Tracing</li>
30<li><a href="#getlttv" name="TOCgetlttv">Getting and installing the LTTV package</ul>
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>
34<li><a href="#section4" name="TOCsection4">Creating Debian and RPM packages
35from LTTV</a>
36
37</ul>
38
39<hr />
40
41<h2><a href="#TOCintro" name="intro">Introduction</a></h2>
42<p>
43This document is made of four parts : the first one explains how
44to install LTTng and LTTV from sources, the second one describes the steps
45to follow to trace a system and view it. The third part explains
46briefly how to add a new trace point to the kernel and to user space
47applications. The fourth and last part explains how to create Debian or RPM
48packages from the LTTng and LTTV sources.
49<p>
50These operations are made for installing the LTTng 0.86 tracer on a linux 2.6.X
51kernel. You will also find instructions for installation of LTTV 0.12.x : the
52Linux Trace Toolkit Viewer.
53To see the list of compatibilities between LTTng, ltt-control, LTTV, please
54refer to :
55<a
56href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/lttng-lttv-compatibility.html">LTTng+LTTV versions compatibility</a>
57The lttng patch is necessary to have the tracing hooks in the kernel.
58
59<br>
60<br>
61Supported architectures :
62br>
63LTTng :<br>
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>
70<br>
71LTTV :<br>
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
77<hr />
78
79
80<h2><a href="#TOCsection1" name="section1">Installation from sources</a></h2>
81<p>
82
83<h3><a href="#TOCprerequisites" name="prerequisites">Prerequisites</a></h3>
84<ul>
85<p>
86Tools needed to follow the package download steps :
87
88<li>wget
89<li>bzip2
90<li>gzip
91<li>tar
92
93<p>
94You have to install the standard development libraries and programs necessary
95to compile a kernel :
96
97<PRE>
98(from Documentation/Changes in the Linux kernel tree)
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>
105
106<p>
107You might also want to have libncurses5 to have the text mode kernel
108configuration menu, but there are alternatives.
109
110<p>
111Prerequisites for LTTV 0.x.x installation are :
112
113<PRE>
114gcc 3.2 or better
115gtk 2.4 or better development libraries
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.
120glib 2.4 or better development libraries
121 (Debian : libglib2.0-0, libglib2.0-dev)
122 (Fedora : glib2, glib2-devel)
123libpopt development libraries
124 (Debian : libpopt0, libpopt-dev)
125 (Fedora : popt)
126libpango development libraries
127 (Debian : libpango1.0, libpango1.0-dev)
128 (Fedora : pango, pango-devel)
129libc6 development librairies
130 (Debian : libc6, libc6-dev)
131 (Fedora : glibc, glibc)
132</PRE>
133</ul>
134
135<li>Reminder</li>
136
137<p>
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>.
142
143
144<h3><a href="#TOCgetlttng" name="getlttng">Getting the LTTng packages</a></h3>
145
146<PRE>
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 -
153</PRE>
154
155
156<h3><a href="#TOCgetlttngsrc" name="getlttngsrc">Getting LTTng kernel sources</a></h3>
157
158<PRE>
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
169</PRE>
170
171
172<h3><a href="#TOCinstalllttng" name="installlttng">Installing a LTTng kernel</a></h3>
173
174<PRE>
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--
227</PRE>
228
229<h3><a href="#TOCeditconfig" name="editconfig">Editing the system wide
230configuration</a></h3>
231
232<p>
233You must activate debugfs and specify a mount point. This is typically done in
234fstab such that it happens at boot time. If you have never used DebugFS before,
235these operation would do this for you :
236
237<PRE>
238mkdir /mnt/debugfs
239cp /etc/fstab /etc/fstab.lttng.bkp
240echo "debugfs /mnt/debugfs debugfs rw 0 0" >> /etc/fstab
241</PRE>
242
243<p>
244then, rebooting or issuing the following command will activate debugfs :
245<PRE>
246mount /mnt/debugfs
247</PRE>
248
249<p>
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
255<PRE>
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
272</PRE>
273
274<p>
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
279<PRE>
280modprobe ltt-statedump
281</PRE>
282<p>
283You can automate at boot time loading the ltt-control module by :
284
285<PRE>
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
303</PRE>
304
305
306<h3><a href="#TOCgetlttctl" name="getlttctl">Getting and installing the
307ltt-control package (on the traced machine)</a></h3>
308<p>
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.)
311
312<PRE>
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
323</PRE>
324
325<h3><a href="#TOCuserspacetracing" name="userspacetracing">Userspace tracing</a></h3>
326
327<PRE>
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
339</PRE>
340
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>
344
345<PRE>
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
356</PRE>
357
358<hr />
359
360
361<h2><a href="#TOCsection2" name="section2">Using LTTng and LTTV</a></h2>
362
363<li>IMPORTANT : Arm Linux Kernel Markers after each boot</li>
364<PRE>
365ltt-armall
366</PRE>
367
368<li>Use graphical LTTV to control tracing and analyse traces</li>
369<PRE>
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
378</PRE>
379
380<li>Use text mode LTTng to control tracing</li>
381<PRE>
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.
394</PRE>
395<p>
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
402<li>Use text mode LTTV</li>
403<p>
404Feel free to look in /usr/local/lib/lttv/plugins to see all the text and
405graphical plugins available.
406<p>
407For example, a simple trace dump in text format is available with :
408<PRE>
409lttv -m textDump -t /tmp/trace
410</PRE>
411<p>
412See lttv -m textDump --help for detailed command line options of textDump.
413<p>
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
420<li>Hybrid mode</li>
421<p>
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.
425<p>
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).
430<p>
431The following lttctl commands take an hybrid trace :
432<p>
433Create trace channel, start lttd on normal channels, start tracing:
434<PRE>
435lttctl -C -w /tmp/trace2 -o channel.kernel.overwrite=1 trace2
436</PRE>
437<p>
438Stop tracing, start lttd on flight recorder channels, destroy trace channels :
439<PRE>
440lttctl -D -w /tmp/trace2 trace2
441</PRE>
442<p>
443Each "overwrite" channel is flight recorder channel.
444
445<li>Flight recorder mode</li>
446<p>
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".
450<p>
451The following lttctl commands take a flight recorder trace :
452<PRE>
453lttctl -C -w /tmp/trace3 -o channel.all.overwrite=1 trace3
454...
455lttctl -D -w /tmp/trace3 trace3
456</PRE>
457
458<hr />
459
460
461<h2><a href="#TOCsection3" name="section3">Adding new instrumentations with the
462markers</a></h2>
463<p>
464
465<p>
466See Documentation/markers.txt and Documentation/tracepoints.txt in your kernel
467tree.
468
469<li>Add new events to userspace programs with
470<a href="http://ltt.polymtl.ca/packages/">userspace markers packages</a></li>
471
472<p>
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.
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
479<p>
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
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.
490
491<hr />
492
493<h2><a href="#TOCsection4" name="section4">Creating Debian or RPM packages</a></h2>
494<p>
495
496<li>Create custom LTTV Debian packages</li>
497
498<PRE>
499Use : dpkg-buildpackage -rfakeroot
500</PRE>
501<p>
502You should then have your LTTV .deb files created for your architecture.
503
504<li>Create custom LTTng packages</li>
505<p>
506For building LTTng Debian packages :
507get the build tree with patches applies as explained in section 2.
508
509<PRE>
510make menuconfig (or xconfig or config) (customize your configuration)
511make-kpkg kernel_image
512</PRE>
513<p>
514You will then see your freshly created .deb in /usr/src. Install it with
515<PRE>
516dpkg -i /usr/src/(image-name).deb
517</PRE>
518<p>
519Then, follow the section "Editing the system wide configuration" in section 2.
520
521
522
523 </body>
524</html>
This page took 0.023263 seconds and 4 git commands to generate.