Fix: add the notion of domain to lttng.1 man page
[lttng-tools.git] / doc / man / lttng.1
... / ...
CommitLineData
1.TH "LTTNG" "1" "July 17, 2012" "" ""
2
3.SH "NAME"
4lttng \(em LTTng 2.0 tracer control command line tool
5
6.SH "SYNOPSIS"
7
8.PP
9.nf
10lttng [OPTIONS] <COMMAND>
11.fi
12.SH "DESCRIPTION"
13
14.PP
15The LTTng project aims at providing highly efficient tracing tools for Linux.
16It's tracers help tracking down performance issues and debugging problems
17involving multiple concurrent processes and threads. Tracing across multiple
18systems is also possible.
19
20The \fBlttng\fP command line tool from the lttng-tools package is used to control
21both kernel and user-space tracing. Every interactions with the tracer should
22be done by this tool or by the liblttng-ctl provided with the lttng-tools
23package.
24
25LTTng uses a session daemon (lttng-sessiond(8)), acting as a tracing registry,
26which allows you to interact with multiple tracers (kernel and user-space)
27inside the same container, a tracing session. Traces can be gathered from the
28kernel and/or instrumented applications (lttng-ust(3)). Aggregating and reading
29those traces is done using the babeltrace(1) text viewer.
30
31We introduce the notion of \fBtracing domains\fP which is essentially a type of
32tracer (kernel or user space for now). In the future, we could see a third
33tracer being for instance an hypervisor. For some commands, you'll need to
34specify on which domain the command applies (-u or -k). For instance, enabling
35a kernel event, you must specify the kernel domain to the command so we know
36for which tracer this event is for.
37
38In order to trace the kernel, the session daemon needs to be running as root.
39LTTng provides the use of a \fBtracing group\fP (default: tracing). Whomever is
40in that group can interact with the root session daemon and thus trace the
41kernel. Session daemons can co-exist meaning that you can have a session daemon
42running as Alice that can be used to trace her applications along side with a
43root daemon or even a Bob daemon. We highly recommend to start the session
44daemon at boot time for stable and long term tracing.
45
46Every user-space applications instrumented with lttng-ust(3), will
47automatically register to the session daemon. This feature gives you the
48ability to list available traceable applications and tracepoints on a per user
49basis. (See \fBlist\fP command).
50.SH "OPTIONS"
51
52.PP
53This program follow the usual GNU command line syntax with long options starting with
54two dashes. Below is a summary of the available options.
55.PP
56
57.TP
58.BR "\-h, \-\-help"
59Show summary of possible options and commands.
60.TP
61.BR "\-v, \-\-verbose"
62Increase verbosity.
63Three levels of verbosity are available which are triggered by putting additional v to
64the option (\-vv or \-vvv)
65.TP
66.BR "\-q, \-\-quiet"
67Suppress all messages (even errors).
68.TP
69.BR "\-g, \-\-group NAME"
70Set unix tracing group name. (default: tracing)
71.TP
72.BR "\-n, \-\-no-sessiond"
73Don't automatically spawn a session daemon.
74.TP
75.BR "\-\-sessiond\-path"
76Set session daemon full binary path.
77.TP
78.BR "\-\-list\-options"
79Simple listing of lttng options.
80.TP
81.BR "\-\-list\-commands"
82Simple listing of lttng commands.
83.SH "COMMANDS"
84
85.TP
86\fBadd-context\fP
87.nf
88Add context to event(s) and/or channel(s).
89
90A context is basically extra information appended to a channel or event. For
91instance, you could ask the tracer to add the PID information within the
92"sched_switch" kernel event. You can also add performance monitoring unit
93counters (perf PMU) using the perf kernel API).
94
95For example, this command will add the context information 'prio' and two perf
96counters (hardware branch misses and cache misses), to all events in the trace
97data output:
98
99# lttng add-context \-k \-t prio \-t perf:branch-misses \-t perf:cache-misses
100
101Please take a look at the help (\-h/\-\-help) for a detailed list of available
102contexts.
103
104If no channel and no event is given (\-c/\-e), the context is added to all
105channels (which applies automatically to all events in that channel). Otherwise
106the context will be added only to the channel (\-c) and/or event (\-e) indicated.
107
108If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
109file.
110.fi
111
112.B OPTIONS:
113
114.nf
115\-h, \-\-help
116 Show summary of possible options and commands.
117\-s, \-\-session NAME
118 Apply on session name.
119\-c, \-\-channel NAME
120 Apply on channel name.
121\-e, \-\-event NAME
122 Apply on event name.
123\-k, \-\-kernel
124 Apply for the kernel tracer
125\-u, \-\-userspace
126 Apply for the user-space tracer
127\-t, \-\-type TYPE
128 Context type. You can repeat this option on the command line. Please
129 use "lttng add-context \-h" to list all available types.
130.fi
131
132.IP
133
134.IP "\fBcalibrate\fP"
135.nf
136Quantify LTTng overhead
137
138The LTTng calibrate command can be used to find out the combined average
139overhead of the LTTng tracer and the instrumentation mechanisms used. This
140overhead can be calibrated in terms of time or using any of the PMU performance
141counter available on the system.
142
143For now, the only calibration implemented is that of the kernel function
144instrumentation (kretprobes).
145
146* Calibrate kernel function instrumentation
147
148Let's use an example to show this calibration. We use an i7 processor with 4
149general-purpose PMU registers. This information is available by issuing dmesg,
150looking for "generic registers".
151
152This sequence of commands will gather a trace executing a kretprobe hooked on
153an empty function, gathering PMU counters LLC (Last Level Cache) misses
154information (see lttng add-context \-\-help to see the list of available PMU
155counters).
156
157# lttng create calibrate-function
158# lttng enable-event calibrate \-\-kernel \-\-function lttng_calibrate_kretprobe
159# lttng add-context \-\-kernel \-t perf:LLC-load-misses \-t perf:LLC-store-misses \\
160 \-t perf:LLC-prefetch-misses
161# lttng start
162# for a in $(seq 1 10); do \\
163 lttng calibrate \-\-kernel \-\-function;
164 done
165# lttng destroy
166# babeltrace $(ls \-1drt ~/lttng-traces/calibrate-function-* | tail \-n 1)
167
168The output from babeltrace can be saved to a text file and opened in a
169spreadsheet (e.g. oocalc) to focus on the per-PMU counter delta between
170consecutive "calibrate_entry" and "calibrate_return" events. Note that these
171counters are per-CPU, so scheduling events would need to be present to account
172for migration between CPU. Therefore, for calibration purposes, only events
173staying on the same CPU must be considered.
174
175The average result, for the i7, on 10 samples:
176
177 Average Std.Dev.
178perf_LLC_load_misses: 5.0 0.577
179perf_LLC_store_misses: 1.6 0.516
180perf_LLC_prefetch_misses: 9.0 14.742
181
182As we can notice, the load and store misses are relatively stable across runs
183(their standard deviation is relatively low) compared to the prefetch misses.
184We can conclude from this information that LLC load and store misses can be
185accounted for quite precisely, but prefetches within a function seems to behave
186too erratically (not much causality link between the code executed and the CPU
187prefetch activity) to be accounted for.
188.fi
189
190.B OPTIONS:
191
192.nf
193\-h, \-\-help
194 Show summary of possible options and commands.
195\-k, \-\-kernel
196 Apply for the kernel tracer
197\-u, \-\-userspace
198 Apply for the user-space tracer
199\-\-function
200 Dynamic function entry/return probe (default)
201.fi
202
203.IP
204
205.IP "\fBcreate\fP [NAME] [OPTIONS]
206.nf
207Create tracing session.
208
209A tracing session contains channel(s) which contains event(s). It is domain
210agnostic meaning that you can enable channels and events for either the
211user-space tracer and/or the kernel tracer. It acts like a container
212aggregating multiple tracing sources.
213
214On creation, a \fB.lttngrc\fP file is created in your $HOME directory
215containing the current session name. If NAME is omitted, a session name is
216automatically created having this form: 'auto-yyyymmdd-hhmmss'.
217
218If no \fB\-o, \-\-output\fP is specified, the traces will be written in
219$HOME/lttng-traces.
220.fi
221
222.B OPTIONS:
223
224.nf
225\-h, \-\-help
226 Show summary of possible options and commands.
227\-\-list-options
228 Simple listing of options
229\-o, \-\-output PATH
230 Specify output path for traces
231
232Using these options, each API call can be controlled individually. For
233instance, \-C does not enable the consumer automatically. You'll need the \-e
234option for that.
235
236\-U, \-\-set-uri=URL
237 Set URL for the enable-consumer destination. It is persistent for the
238 session lifetime. Redo the command to change it. This will set both
239 data and control URL for network.
240\-C, \-\-ctrl-url=URL
241 Set control path URL. (Must use -D also)
242\-D, \-\-data-url=URL
243 Set data path URL. (Must use -C also)
244 \-\-no-consumer
245 Don't activate a consumer for this session.
246 \-\-disable-consumer
247 Disable consumer for this session.
248
249See \fBenable-consumer\fP command below for the supported URL format.
250
251.B EXAMPLES:
252
253# lttng create -U net://192.168.1.42
254Uses TCP and default ports for the given destination.
255
256# lttng create -U net6://[fe80::f66d:4ff:fe53:d220]
257Uses TCP, default ports and IPv6.
258
259# lttng create s1 -U net://myhost.com:3229
260Create session s1 and set its consumer to myhost.com on port 3229 for control.
261.fi
262
263.IP
264
265.IP "\fBdestroy\fP [OPTIONS] [NAME]"
266.nf
267Teardown tracing session
268
269Free memory on the session daemon and tracer side. It's gone!
270
271If NAME is omitted, the session name is taken from the .lttngrc file.
272.fi
273
274.B OPTIONS:
275
276.nf
277\-h, \-\-help
278 Show summary of possible options and commands.
279\-a, \-\-all
280 Destroy all sessions
281\-\-list-options
282 Simple listing of options
283.fi
284
285.IP
286
287.IP "\fBenable-channel\fP NAME[,NAME2,...] [-k|-u] [OPTIONS]"
288.nf
289Enable tracing channel
290
291To enable event, you must first enable a channel which contains event(s).
292
293If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
294file.
295.fi
296
297.B OPTIONS:
298
299.nf
300\-h, \-\-help
301 Show this help
302\-\-list-options
303 Simple listing of options
304\-s, \-\-session
305 Apply on session name
306\-k, \-\-kernel
307 Apply to the kernel tracer
308\-u, \-\-userspace
309 Apply to the user-space tracer
310
311\-\-discard
312 Discard event when subbuffers are full (default)
313\-\-overwrite
314 Flight recorder mode : overwrites events when subbuffers are full
315\-\-subbuf-size
316 Subbuffer size in bytes (default: 4096, kernel default: 262144)
317\-\-num-subbuf
318 Number of subbuffers (default: 4)
319 Needs to be a power of 2 for kernel and ust tracers
320\-\-switch-timer
321 Switch subbuffer timer interval in usec (default: 0)
322 Needs to be a power of 2 for kernel and ust tracers
323\-\-read-timer
324 Read timer interval in usec (default: 200)
325.fi
326
327.IP
328
329.IP "\fBenable-consumer\fP [-u|-k] [URL] [OPTIONS]"
330.nf
331Enable a consumer for the tracing session and domain.
332
333By default, every tracing session has a consumer attached to it using the local
334filesystem as output. The trace is written in $HOME/lttng-traces. This command
335allows the user to specify a specific URL after the session was created for a
336specific domain. If no domain is specified, the consumer is applied on all
337domains.
338
339Without options, the behavior is to enable a consumer to the current URL. The
340default URL is the local filesystem at the path of the session mentioned above.
341
342The enable-consumer feature supports both local and network transport. You must
343have a running \fBlttng-relayd(8)\fP for network transmission or any other daemon
344that can understand the streaming protocol of LTTng.
345.fi
346
347.B OPTIONS:
348
349.nf
350\-h, \-\-help
351 Show summary of possible options and commands.
352\-\-list-options
353 Simple listing of options
354\-s, \-\-session
355 Apply on session name
356\-k, \-\-kernel
357 Apply for the kernel tracer
358\-u, \-\-userspace
359 Apply for the user-space tracer
360
361Using these options, each API call can be controlled individually. For
362instance, \-C does not enable the consumer automatically. You'll need the \-e
363option for that.
364
365\-U, \-\-set-uri=URL
366 Set URL for the enable-consumer destination. It is persistent for the
367 session lifetime. Redo the command to change it. This will set both
368 data and control URL for network.
369\-C, \-\-ctrl-url=URL
370 Set control path URL. (Must use -D also)
371\-D, \-\-data-url=URL
372 Set data path URL. (Must use -C also)
373\-e, \-\-enable
374 Enable consumer
375
376.B URL FORMAT:
377
378proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
379
380Supported protocols are (proto):
381> file://...
382 Local filesystem full path.
383
384> net[6]://...
385 This will use the default network transport layer which is TCP for both
386 control (PORT1) and data port (PORT2). The default ports are
387 respectively 5342 and 5343.
388
389> tcp[6]://...
390 Can only be used with -C and -D together
391
392NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)
393
394.B EXAMPLES:
395
396$ lttng enable-consumer -u net://192.168.1.42
397
398Uses TCP and default ports for user space tracing (-u) where the IP address
399above is the destination machine where the traces will be streamed and a
400\fBlttng-relayd(8)\fP is listening.
401.fi
402
403.IP "\fBenable-event\fP NAME[,NAME2,...] [-k|-u] [OPTIONS]"
404.nf
405Enable tracing event
406
407A tracing event is always assigned to a channel. If \fB\-c, \-\-channel\fP is
408omitted, a default channel named '\fBchannel0\fP' is created and the event is
409added to it. For the user-space tracer, using \fB\-a, \-\-all\fP is the same as
410using the wildcard "*".
411
412If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
413file.
414.fi
415
416.B OPTIONS:
417
418.nf
419\-h, \-\-help
420 Show summary of possible options and commands.
421\-\-list-options
422 Simple listing of options
423\-s, \-\-session
424 Apply on session name
425\-c, \-\-channel
426 Apply on channel name
427\-a, \-\-all
428 Enable all tracepoints and syscalls
429\-k, \-\-kernel
430 Apply for the kernel tracer
431\-u, \-\-userspace
432 Apply for the user-space tracer
433
434\-\-tracepoint
435 Tracepoint event (default)
436 - userspace tracer supports wildcards at end of string. Don't forget to
437 quote to deal with bash expansion.
438 e.g.:
439 "*"
440 "app_component:na*"
441\-\-loglevel
442 Tracepoint loglevel
443\-\-probe [addr | symbol | symbol+offset]
444 Dynamic probe. Addr and offset can be octal (0NNN...), decimal (NNN...)
445 or hexadecimal (0xNNN...)
446\-\-function [addr | symbol | symbol+offset]
447 Dynamic function entry/return probe. Addr and offset can be octal
448 (0NNN...), decimal (NNN...) or hexadecimal (0xNNN...)
449\-\-syscall
450 System call event. Enabling syscalls tracing (kernel tracer), you will
451 not be able to disable them with disable-event. This is a known
452 limitation. You can disable the entire channel to do the trick.
453
454\-\-filter 'expression'
455 Set a filter on a newly enabled event. Filter expression on event
456 fields, event recording depends on evaluation. Only specify on first
457 activation of a given event within a session. Filter only allowed when
458 enabling events within a session before tracing is started. If the
459 filter fails to link with the event within the traced domain, the event
460 will be discarded. Currently, filter is only implemented for the
461 user-space tracer.
462
463 Expression examples:
464
465 'intfield > 500 && intfield < 503'
466 '(stringfield == "test" || intfield != 10) && intfield > 33'
467 'doublefield > 1.1 && intfield < 5.3'
468
469 Wildcards are allowed at the end of strings:
470 'seqfield1 == "te*"'
471 In string literals, the escape character is a '\\'. Use '\\*' for
472 the '*' character, and '\\\\' for the '\\' character.
473.fi
474
475.IP "\fBdisable-channel\fP NAME[,NAME2,...] [\-k|\-u] [OPTIONS]"
476.nf
477Disable tracing channel
478
479Disabling a channel makes all event(s) in that channel to stop tracing. You can
480enable it back by calling \fBlttng enable-channel NAME\fP again.
481
482If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
483file.
484.fi
485
486.B OPTIONS:
487
488.nf
489\-h, \-\-help
490 Show summary of possible options and commands.
491\-\-list-options
492 Simple listing of options
493\-s, \-\-session NAME
494 Apply on session name
495\-k, \-\-kernel
496 Apply for the kernel tracer
497\-u, \-\-userspace
498 Apply for the user-space tracer
499.fi
500
501.IP "\fBdisable-consumer\fP [\-k|\-u] [OPTIONS]"
502.nf
503Disable the consumer of a tracing session.
504
505This call MUST be done BEFORE tracing has started.
506.fi
507
508.B OPTIONS:
509
510.nf
511\-h, \-\-help
512 Show summary of possible options and commands.
513\-\-list-options
514 Simple listing of options
515\-s, \-\-session NAME
516 Apply on session name
517\-k, \-\-kernel
518 Apply for the kernel tracer
519\-u, \-\-userspace
520 Apply for the user-space tracer
521.fi
522
523.IP "\fBdisable-event\fP NAME[,NAME2,...] [\-k|\-u] [OPTIONS]"
524.nf
525Disable tracing event
526
527The event, once disabled, can be re-enabled by calling \fBlttng enable-event
528NAME\fP again.
529
530If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
531file.
532.fi
533
534.B OPTIONS:
535
536.nf
537\-h, \-\-help
538 Show summary of possible options and commands.
539\-\-list-options
540 Simple listing of options
541\-s, \-\-session
542 Apply on session name
543\-k, \-\-kernel
544 Apply for the kernel tracer
545\-u, \-\-userspace
546 Apply for the user-space tracer
547.fi
548
549.IP "\fBlist\fP [\-k|\-u] [SESSION [SESSION_OPTIONS]]"
550.nf
551List tracing session information.
552
553With no arguments, it will list available tracing session(s).
554
555With the session name, it will display the details of the session including
556the trace file path, the associated channels and their state (activated
557and deactivated), the activated events and more.
558
559With \-k alone, it will list all available kernel events (except the system
560calls events).
561With \-u alone, it will list all available user-space events from registered
562applications. Here is an example of 'lttng list \-u':
563
564PID: 7448 - Name: /tmp/lttng-ust/tests/hello/.libs/lt-hello
565 ust_tests_hello:tptest_sighandler (type: tracepoint)
566 ust_tests_hello:tptest (type: tracepoint)
567
568You can now enable any event listed by using the name :
569\fBust_tests_hello:tptest\fP.
570.fi
571
572.B OPTIONS:
573
574.nf
575\-h, \-\-help
576 Show summary of possible options and commands.
577\-\-list-options
578 Simple listing of options
579\-k, \-\-kernel
580 Select kernel domain
581\-u, \-\-userspace
582 Select user-space domain.
583
584.B SESSION OPTIONS:
585
586\-c, \-\-channel NAME
587 List details of a channel
588\-d, \-\-domain
589 List available domain(s)
590.fi
591
592.IP "\fBset-session\fP NAME"
593.nf
594Set current session name
595
596Will change the session name in the .lttngrc file.
597.fi
598
599.B OPTIONS:
600
601.nf
602\-h, \-\-help
603 Show summary of possible options and commands.
604\-\-list-options
605 Simple listing of options
606.fi
607
608.IP
609
610.IP "\fBstart\fP [NAME] [OPTIONS]"
611.nf
612Start tracing
613
614It will start tracing for all tracers for a specific tracing session.
615
616If NAME is omitted, the session name is taken from the .lttngrc file.
617.fi
618
619.B OPTIONS:
620
621.nf
622\-h, \-\-help
623 Show summary of possible options and commands.
624\-\-list-options
625 Simple listing of options
626.fi
627
628.IP
629
630.IP "\fBstop\fP [NAME] [OPTIONS]"
631.nf
632Stop tracing
633
634It will stop tracing for all tracers for a specific tracing session.
635
636If NAME is omitted, the session name is taken from the .lttngrc file.
637.fi
638
639.B OPTIONS:
640
641.nf
642\-h, \-\-help
643 Show summary of possible options and commands.
644\-\-list-options
645 Simple listing of options
646.fi
647
648.IP
649
650.IP "\fBversion\fP"
651.nf
652Show version information
653.fi
654
655.B OPTIONS:
656
657.nf
658\-h, \-\-help
659 Show summary of possible options and commands.
660\-\-list-options
661 Simple listing of options
662.fi
663
664.IP
665
666.IP "\fBview\fP [SESSION_NAME] [OPTIONS]"
667.nf
668View traces of a tracing session
669
670By default, the babeltrace viewer will be used for text viewing.
671
672If SESSION_NAME is omitted, the session name is taken from the .lttngrc file.
673
674.fi
675
676.B OPTIONS:
677
678.nf
679\-h, \-\-help
680 Show this help
681\-\-list-options
682 Simple listing of options
683\-t, \-\-trace-path PATH
684 Trace directory path for the viewer
685\-e, \-\-viewer CMD
686 Specify viewer and/or options to use
687 This will completely override the default viewers so
688 please make sure to specify the full command. The trace
689 directory path of the session will be appended at the end
690 to the arguments
691.fi
692
693.SH "EXIT VALUES"
694On success 0 is returned and a positive value on error. Value of 1 means a command
695error, 2 an undefined command, 3 a fatal error and 4 a command warning meaning that
696something went wrong during the command.
697
698Any other value above 10, please refer to
699.BR <lttng/lttng-error.h>
700for a detailed list or use lttng_strerror() to get a human readable string of
701the error code.
702
703.PP
704.SH "ENVIRONMENT VARIABLES"
705
706.PP
707Note that all command line options override environment variables.
708.PP
709
710.PP
711.IP "LTTNG_SESSIOND_PATH"
712Allows one to specify the full session daemon binary path to lttng command line
713tool. You can also use \-\-sessiond-path option having the same effect.
714.SH "SEE ALSO"
715.BR babeltrace(1),
716.BR lttng-ust(3),
717.BR lttng-sessiond(8),
718.BR lttng-relayd(8),
719.BR lttng-health-check(3)
720.SH "BUGS"
721
722With version 2.1 and earlier, if you start a tracing session and than enable
723kernel events, they are not recorded and the tracing session fails to stop. To
724fix this, simply enable events before starting the session.
725
726If you encounter any issues or usability problem, please report it on our
727mailing list <lttng-dev@lists.lttng.org> to help improve this project or
728at https://bugs.lttng.org which is a bugtracker.
729.SH "CREDITS"
730
731.PP
732lttng is distributed under the GNU General Public License version 2. See the file
733COPYING for details.
734.PP
735A Web site is available at http://lttng.org for more information on the LTTng
736project.
737.PP
738You can also find our git tree at http://git.lttng.org.
739.PP
740Mailing lists for support and development: <lttng-dev@lists.lttng.org>.
741.PP
742You can find us on IRC server irc.oftc.net (OFTC) in #lttng.
743.PP
744.SH "THANKS"
745
746.PP
747Thanks to Yannick Brosseau without whom this project would never have been so
748lean and mean! Also thanks to the Ericsson teams working on tracing which
749helped us greatly with detailed bug reports and unusual test cases.
750
751Thanks to our beloved packager Alexandre Montplaisir-Goncalves (Ubuntu and PPA
752maintainer) and Jon Bernard for our Debian packages.
753
754Special thanks to Michel Dagenais and the DORSAL laboratory at Polytechnique de
755Montreal for the LTTng journey.
756.PP
757.SH "AUTHORS"
758
759.PP
760lttng-tools was originally written by Mathieu Desnoyers, Julien Desfossez and
761David Goulet. More people have since contributed to it. It is currently
762maintained by David Goulet <dgoulet@efficios.com>.
763.PP
This page took 0.024226 seconds and 4 git commands to generate.