update quickstart html
[lttv.git] / trunk / lttv / QUICKSTART.html
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
10 Author : Mathieu Desnoyers, September 2005<br>
11 Last 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
19 sources</a></li>
20 <ul>
21 <li><a href="#prerequisites" name="TOCprerequisites">Prerequisistes</ul>
22 <li><a href="#getlttng" name="TOCgetlttng">Getting the LTTng packages</ul>
23 <li><a href="#getlttngsrc" name="TOCgetlttngsrc">Getting the LTTng kernel sources</ul>
24 <li><a href="#installlttng" name="TOCinstalllttng">Installing a LTTng kernel</ul>
25 <li><a href="#editconfig" name="TOCeditconfig">Editing the system wide
26 configuration</a>
27 <li><a href="#getlttctl" name="TOCgetlttctl">Getting and installing the
28 ltt-control package</ul>
29 <li><a href="#userspacetracing" name="TOCuserspacetracing">Userspace Tracing</ul>
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
33 tracepoints</a></li>
34 <li><a href="#section4" name="TOCsection4">Creating Debian and RPM packages
35 from LTTV</a>
36
37 </ul>
38
39 <hr />
40
41 <h2><a href="#TOCintro" name="intro">Introduction</a></h2>
42 <p>
43 This document is made of four parts : the first one explains how
44 to install LTTng and LTTV from sources, the second one describes the steps
45 to follow to trace a system and view it. The third part explains
46 briefly how to add a new trace point to the kernel and to user space
47 applications. The fourth and last part explains how to create Debian or RPM
48 packages from the LTTng and LTTV sources.
49 <p>
50 These operations are made for installing the LTTng 0.86 tracer on a linux 2.6.X
51 kernel. You will also find instructions for installation of LTTV 0.12.x : the
52 Linux Trace Toolkit Viewer.
53 To see the list of compatibilities between LTTng, ltt-control, LTTV, please
54 refer to :
55 <a
56 href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/lttng-lttv-compatibility.html">LTTng+LTTV versions compatibility</a>
57 The lttng patch is necessary to have the tracing hooks in the kernel.
58
59 <br>
60 <br>
61 Supported architectures :
62 br>
63 LTTng :<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
67 architecture-specific support for better precision)
68 <li> MIPS
69 <br>
70 <br>
71 LTTV :<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
75 the 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>
86 Tools needed to follow the package download steps :
87
88 <li>wget
89 <li>bzip2
90 <li>gzip
91 <li>tar
92
93 <p>
94 You have to install the standard development libraries and programs necessary
95 to compile a kernel :
96
97 <PRE>
98 (from Documentation/Changes in the Linux kernel tree)
99 Gnu C 2.95.3 # gcc --version
100 Gnu make 3.79.1 # make --version
101 binutils 2.12 # ld -v
102 util-linux 2.10o # fdformat --version
103 module-init-tools 0.9.10 # depmod -V
104 </PRE>
105
106 <p>
107 You might also want to have libncurses5 to have the text mode kernel
108 configuration menu, but there are alternatives.
109
110 <p>
111 Prerequisites for LTTV 0.x.x installation are :
112
113 <PRE>
114 gcc 3.2 or better
115 gtk 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.
120 glib 2.4 or better development libraries
121 (Debian : libglib2.0-0, libglib2.0-dev)
122 (Fedora : glib2, glib2-devel)
123 libpopt development libraries
124 (Debian : libpopt0, libpopt-dev)
125 (Fedora : popt)
126 libpango development libraries
127 (Debian : libpango1.0, libpango1.0-dev)
128 (Fedora : pango, pango-devel)
129 libc6 development librairies
130 (Debian : libc6, libc6-dev)
131 (Fedora : glibc, glibc)
132 </PRE>
133 </ul>
134
135 <li>Reminder</li>
136
137 <p>
138 See the list of compatibilities between LTTng, ltt-control and LTTV at :
139 <a
140 href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/lttng-lttv-compatibility.html">LTTng+LTTV
141 versions compatibility</a>.
142
143
144 <h3><a href="#TOCgetlttng" name="getlttng">Getting the LTTng packages</a></h3>
145
146 <PRE>
147 su -
148 mkdir /usr/src/lttng
149 cd /usr/src/lttng
150 (see http://ltt.polymtl.ca/lttng for package listing)
151 wget http://ltt.polymtl.ca/lttng/patch-2.6.X-lttng-0.x.xx.tar.bz2
152 bzip2 -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>
159 su -
160 cd /usr/src
161 wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.X.tar.bz2
162 bzip2 -cd linux-2.6.X.tar.bz2 | tar xvof -
163 cd 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
167 cd ..
168 mv 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>
175 su -
176 cd /usr/src/linux-2.6.X-lttng-0.x.xx
177 make 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>
204 make
205 make 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
210 make install
211 reboot
212 Select the Linux 2.6.X-lttng-0.x.xx kernel in your boot loader.
213
214 -- on PowerPC
215 cp vmlinux.strip /boot/vmlinux-2.6.X-lttng-0.x.xx
216 cp System.map /boot/System.map-2.6.X-lttng-0.x.xx
217 cp .config /boot/config-2.6.X-lttng-0.x.xx
218 depmod -ae -F /boot/System.map-2.6.X-lttng-0.x.xx 2.6.X-lttng-0.x.xx
219 mkinitrd /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
221 that comes first is the default kernel)
222 ybin
223 select the right entry at the yaboot prompt (see choices : tab, select : type
224 the kernel name followed by enter)
225 Select 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
230 configuration</a></h3>
231
232 <p>
233 You must activate debugfs and specify a mount point. This is typically done in
234 fstab such that it happens at boot time. If you have never used DebugFS before,
235 these operation would do this for you :
236
237 <PRE>
238 mkdir /mnt/debugfs
239 cp /etc/fstab /etc/fstab.lttng.bkp
240 echo "debugfs /mnt/debugfs debugfs rw 0 0" >> /etc/fstab
241 </PRE>
242
243 <p>
244 then, rebooting or issuing the following command will activate debugfs :
245 <PRE>
246 mount /mnt/debugfs
247 </PRE>
248
249 <p>
250 You need to load the LTT modules to be able to control tracing from user
251 space. This is done by issuing the following commands. Note however
252 these commands load all LTT modules. Depending on what options you chose to
253 compile statically, you may not need to issue all these commands.
254
255 <PRE>
256 modprobe ltt-trace-control
257 modprobe ltt-marker-control
258 modprobe ltt-tracer
259 modprobe ltt-serialize
260 modprobe ltt-relay
261 modprobe ipc-trace
262 modprobe kernel-trace
263 modprobe mm-trace
264 modprobe net-trace
265 modprobe fs-trace
266 modprobe jbd2-trace
267 modprobe ext4-trace
268 modprobe syscall-trace
269 modprobe trap-trace
270 #if locking tracing is wanted, uncomment the following
271 #modprobe lockdep-trace
272 </PRE>
273
274 <p>
275 If you want to have complete information about the kernel state (including all
276 the process names), you need to load the ltt-statedump module. This is done by
277 issuing the command :
278
279 <PRE>
280 modprobe ltt-statedump
281 </PRE>
282 <p>
283 You can automate at boot time loading the ltt-control module by :
284
285 <PRE>
286 cp /etc/modules /etc/modules.bkp
287 echo ltt-trace-control >> /etc/modules
288 echo ltt-marker-control >> /etc/modules
289 echo ltt-tracer >> /etc/modules
290 echo ltt-serialize >> /etc/modules
291 echo ltt-relay >> /etc/modules
292 echo ipc-trace >> /etc/modules
293 echo kernel-trace >> /etc/modules
294 echo mm-trace >> /etc/modules
295 echo net-trace >> /etc/modules
296 echo fs-trace >> /etc/modules
297 echo jbd2-trace >> /etc/modules
298 echo ext4-trace >> /etc/modules
299 echo syscall-trace >> /etc/modules
300 echo 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
307 ltt-control package (on the traced machine)</a></h3>
308 <p>
309 (note : the ltt-control package contains lttd and lttctl. Although it has the
310 same name as the ltt-control kernel module, they are *not* the same thing.)
311
312 <PRE>
313 su -
314 cd /usr/src
315 wget http://ltt.polymtl.ca/lttng/ltt-control-0.x-xxxx2006.tar.gz
316 gzip -cd ltt-control-0.x-xxxx2008.tar.gz | tar xvof -
317 cd ltt-control-0.x-xxxx2006
318 (refer to README to see the development libraries that must be installed on you
319 system)
320 ./configure
321 make
322 make install
323 </PRE>
324
325 <h3><a href="#TOCuserspacetracing" name="userspacetracing">Userspace tracing</a></h3>
326
327 <PRE>
328 Make sure you selected the kernel menuconfig option :
329 <M> or <*> Support logging events from userspace
330 And that the ltt-userspace-event kernel module is loaded if selected as a
331 module.
332
333 Simple userspace tracing is available through
334 echo "some text to record" > /mnt/debugfs/ltt/write_event
335
336 It will appear in the trace under event :
337 channel : userspace
338 event name : event
339 </PRE>
340
341 <h3><a href="#TOCgetlttv" name="getlttv">Getting and installing the LTTV package
342 (on the visualisation machine, same
343 or different from the visualisation machine)</a></h3>
344
345 <PRE>
346 su -
347 cd /usr/src
348 wget http://ltt.polymtl.ca/packages/lttv-0.x.xx-xxxx2008.tar.gz
349 gzip -cd lttv-0.x.xx-xxxx2008.tar.gz | tar xvof -
350 cd lttv-0.x.xx-xxxx2008
351 (refer to README to see the development libraries that must be installed on your
352 system)
353 ./configure
354 make
355 make 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>
365 ltt-armall
366 </PRE>
367
368 <li>Use graphical LTTV to control tracing and analyse traces</li>
369 <PRE>
370 lttv-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>
382 The tracing can be controlled from a terminal by using the lttctl command (as
383 root).
384
385 Start tracing :
386
387 lttctl -C -w /tmp/trace1 trace1
388
389 Stop tracing and destroy trace channels :
390
391 lttctl -D trace1
392
393 see lttctl --help for details.
394 </PRE>
395 <p>
396 (note : to see if the buffers has been filled, look at the dmesg output after
397 lttctl -R or after stopping tracing from the GUI, it will show an event lost
398 count. If it is the case, try using larger buffers. See lttctl --help to learn
399 how. lttv now also shows event lost messages in the console when loading a trace
400 with missing events or lost subbuffers.)
401
402 <li>Use text mode LTTV</li>
403 <p>
404 Feel free to look in /usr/local/lib/lttv/plugins to see all the text and
405 graphical plugins available.
406 <p>
407 For example, a simple trace dump in text format is available with :
408 <PRE>
409 lttv -m textDump -t /tmp/trace
410 </PRE>
411 <p>
412 See lttv -m textDump --help for detailed command line options of textDump.
413 <p>
414 It is, in the current state of the project, very useful to use "grep" on the
415 text output to filter by specific event fields. You can later copy the timestamp
416 of the events to the clipboard and paste them in the GUI by clicking on the
417 bottom right label "Current time". Support for this type of filtering should
418 be added to the filter module soon.
419
420 <li>Hybrid mode</li>
421 <p>
422 Starting from LTTng 0.5.105 and ltt-control 0.20, a new mode can be used :
423 hybrid. It can be especially useful when studying big workloads on a long period
424 of time.
425 <p>
426 When using this mode, the most important, low rate control information will be
427 recorded during all the trace by lttd (i.e. process creation/exit). The high
428 rate information (i.e. interrupt/traps/syscall entry/exit) will be kept in a
429 flight recorder buffer (now named flight-channelname_X).
430 <p>
431 The following lttctl commands take an hybrid trace :
432 <p>
433 Create trace channel, start lttd on normal channels, start tracing:
434 <PRE>
435 lttctl -C -w /tmp/trace2 -o channel.kernel.overwrite=1 trace2
436 </PRE>
437 <p>
438 Stop tracing, start lttd on flight recorder channels, destroy trace channels :
439 <PRE>
440 lttctl -D -w /tmp/trace2 trace2
441 </PRE>
442 <p>
443 Each "overwrite" channel is flight recorder channel.
444
445 <li>Flight recorder mode</li>
446 <p>
447 The flight recorder mode writes data into overwritten buffers for all channels,
448 including control channels, except for the facilities tracefiles. It consists of
449 setting all channels to "overwrite".
450 <p>
451 The following lttctl commands take a flight recorder trace :
452 <PRE>
453 lttctl -C -w /tmp/trace3 -o channel.all.overwrite=1 trace3
454 ...
455 lttctl -D -w /tmp/trace3 trace3
456 </PRE>
457
458 <hr />
459
460
461 <h2><a href="#TOCsection3" name="section3">Adding new instrumentations with the
462 markers</a></h2>
463 <p>
464
465 <p>
466 See Documentation/markers.txt and Documentation/tracepoints.txt in your kernel
467 tree.
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>
473 Get the latest markers-userspace-*.tar.bz2 and see the Makefile and examples. It
474 allows inserting markers in executables and libraries, currently only on x86_32
475 and x86_64.
476 See <a
477 href="http://ltt.polymtl.ca/packages/markers-userspace-0.5.tar.bz2">markers-userspace-0.5.tar.bz2</a> or more recent.
478
479 <p>
480 Note that a new design document for a 3rd generation of tracepoint/marker-based
481 userspace tracing is available at <a
482 href="http://ltt.polymtl.ca/svn/trunk/lttv/doc/developer/ust.html">LTTng User-space Tracing
483 Design"</a>. This new infrastructure is not yet implemented.
484
485 <p>
486 The easy quick-and-dirty way to perform userspace tracing is currently to write
487 an string to /mnt/debugfs/ltt/write_event. See <a
488 href="#userspacetracing">Userspace tracing</a> in the
489 installation 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>
499 Use : dpkg-buildpackage -rfakeroot
500 </PRE>
501 <p>
502 You should then have your LTTV .deb files created for your architecture.
503
504 <li>Create custom LTTng packages</li>
505 <p>
506 For building LTTng Debian packages :
507 get the build tree with patches applies as explained in section 2.
508
509 <PRE>
510 make menuconfig (or xconfig or config) (customize your configuration)
511 make-kpkg kernel_image
512 </PRE>
513 <p>
514 You will then see your freshly created .deb in /usr/src. Install it with
515 <PRE>
516 dpkg -i /usr/src/(image-name).deb
517 </PRE>
518 <p>
519 Then, follow the section "Editing the system wide configuration" in section 2.
520
521
522
523 </body>
524 </html>
This page took 0.039663 seconds and 4 git commands to generate.