Fix: bad protocol flow between sessiond and consumerd
[lttng-tools.git] / doc / man / lttng.1
... / ...
CommitLineData
1.TH "LTTNG" "1" "December 3rd, 2012" "" ""
2
3.SH "NAME"
4lttng \(em LTTng 2.x 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 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. For instance,
91you could ask the tracer to add the PID information for all events in a
92channel. You can also add performance monitoring unit counters (perf PMU) using
93the 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 is given (\-c), the context is added to all channels. Otherwise
105the context will be added only to the given channel (\-c).
106
107If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
108file.
109.fi
110
111.B OPTIONS:
112
113.nf
114\-h, \-\-help
115 Show summary of possible options and commands.
116\-s, \-\-session NAME
117 Apply on session name.
118\-c, \-\-channel NAME
119 Apply on channel name.
120\-k, \-\-kernel
121 Apply for the kernel tracer
122\-u, \-\-userspace
123 Apply for the user-space tracer
124\-t, \-\-type TYPE
125 Context type. You can repeat this option on the command line. Please
126 use "lttng add-context \-h" to list all available types.
127.fi
128
129.IP
130
131.IP "\fBcalibrate\fP"
132.nf
133Quantify LTTng overhead
134
135The LTTng calibrate command can be used to find out the combined average
136overhead of the LTTng tracer and the instrumentation mechanisms used. This
137overhead can be calibrated in terms of time or using any of the PMU performance
138counter available on the system.
139
140For now, the only calibration implemented is that of the kernel function
141instrumentation (kretprobes).
142
143* Calibrate kernel function instrumentation
144
145Let's use an example to show this calibration. We use an i7 processor with 4
146general-purpose PMU registers. This information is available by issuing dmesg,
147looking for "generic registers".
148
149This sequence of commands will gather a trace executing a kretprobe hooked on
150an empty function, gathering PMU counters LLC (Last Level Cache) misses
151information (see lttng add-context \-\-help to see the list of available PMU
152counters).
153
154# lttng create calibrate-function
155# lttng enable-event calibrate \-\-kernel \-\-function lttng_calibrate_kretprobe
156# lttng add-context \-\-kernel \-t perf:LLC-load-misses \-t perf:LLC-store-misses \\
157 \-t perf:LLC-prefetch-misses
158# lttng start
159# for a in $(seq 1 10); do \\
160 lttng calibrate \-\-kernel \-\-function;
161 done
162# lttng destroy
163# babeltrace $(ls \-1drt ~/lttng-traces/calibrate-function-* | tail \-n 1)
164
165The output from babeltrace can be saved to a text file and opened in a
166spreadsheet (e.g. oocalc) to focus on the per-PMU counter delta between
167consecutive "calibrate_entry" and "calibrate_return" events. Note that these
168counters are per-CPU, so scheduling events would need to be present to account
169for migration between CPU. Therefore, for calibration purposes, only events
170staying on the same CPU must be considered.
171
172The average result, for the i7, on 10 samples:
173
174 Average Std.Dev.
175perf_LLC_load_misses: 5.0 0.577
176perf_LLC_store_misses: 1.6 0.516
177perf_LLC_prefetch_misses: 9.0 14.742
178
179As we can notice, the load and store misses are relatively stable across runs
180(their standard deviation is relatively low) compared to the prefetch misses.
181We can conclude from this information that LLC load and store misses can be
182accounted for quite precisely, but prefetches within a function seems to behave
183too erratically (not much causality link between the code executed and the CPU
184prefetch activity) to be accounted for.
185.fi
186
187.B OPTIONS:
188
189.nf
190\-h, \-\-help
191 Show summary of possible options and commands.
192\-k, \-\-kernel
193 Apply for the kernel tracer
194\-u, \-\-userspace
195 Apply for the user-space tracer
196\-\-function
197 Dynamic function entry/return probe (default)
198.fi
199
200.IP
201
202.IP "\fBcreate\fP [NAME] [OPTIONS]
203.nf
204Create tracing session.
205
206A tracing session contains channel(s) which contains event(s). It is domain
207agnostic meaning that you can enable channels and events for either the
208user-space tracer and/or the kernel tracer. It acts like a container
209aggregating multiple tracing sources.
210
211On creation, a \fB.lttngrc\fP file is created in your $HOME directory
212containing the current session name. If NAME is omitted, a session name is
213automatically created having this form: 'auto-yyyymmdd-hhmmss'.
214
215If no \fB\-o, \-\-output\fP is specified, the traces will be written in
216$HOME/lttng-traces.
217
218The $HOME environment variable can be overridden by defining the environment
219variable LTTNG_HOME. This is useful when the user running the commands has
220a non-writeable home directory.
221.fi
222
223.B OPTIONS:
224
225.nf
226\-h, \-\-help
227 Show summary of possible options and commands.
228\-\-list-options
229 Simple listing of options
230\-o, \-\-output PATH
231 Specify output path for traces
232
233Using these options, each API call can be controlled individually. For
234instance, \-C does not enable the consumer automatically. You'll need the \-e
235option for that.
236
237\-U, \-\-set-url=URL
238 Set URL for the consumer output destination. It is persistent for the
239 session lifetime. Redo the command to change it. This will set both
240 data and control URL for network.
241\-C, \-\-ctrl-url=URL
242 Set control path URL. (Must use -D also)
243\-D, \-\-data-url=URL
244 Set data path URL. (Must use -C also)
245
246.B URL FORMAT:
247
248proto://[HOST|IP][:PORT1[:PORT2]][/TRACE_PATH]
249
250Supported protocols are (proto):
251> file://...
252 Local filesystem full path.
253
254> net://...
255 This will use the default network transport layer which is TCP for both
256 control (PORT1) and data port (PORT2). The default ports are
257 respectively 5342 and 5343. Note that net[6]:// is not yet supported.
258
259> tcp[6]://...
260 Can only be used with -C and -D together
261
262NOTE: IPv6 address MUST be enclosed in brackets '[]' (rfc2732)
263
264.B EXAMPLES:
265
266# lttng create -U net://192.168.1.42
267Uses TCP and default ports for the given destination.
268
269# lttng create -U net6://[fe80::f66d:4ff:fe53:d220]
270Uses TCP, default ports and IPv6.
271
272# lttng create s1 -U net://myhost.com:3229
273Create session s1 and set its consumer to myhost.com on port 3229 for control.
274.fi
275
276.IP
277
278.IP "\fBdestroy\fP [OPTIONS] [NAME]"
279.nf
280Teardown tracing session
281
282Free memory on the session daemon and tracer side. It's gone!
283
284If NAME is omitted, the session name is taken from the .lttngrc file.
285.fi
286
287.B OPTIONS:
288
289.nf
290\-h, \-\-help
291 Show summary of possible options and commands.
292\-a, \-\-all
293 Destroy all sessions
294\-\-list-options
295 Simple listing of options
296.fi
297
298.IP
299
300.IP "\fBenable-channel\fP NAME[,NAME2,...] [-k|-u] [OPTIONS]"
301.nf
302Enable tracing channel
303
304To enable an event, you must enable both the event and the channel that
305contains it.
306
307If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
308file.
309
310It is important to note that if a certain type of buffers is used, the session
311will be set with that type and all other subsequent channel need to have the
312same type.
313.fi
314
315.B OPTIONS:
316
317.nf
318\-h, \-\-help
319 Show this help
320\-\-list-options
321 Simple listing of options
322\-s, \-\-session NAME
323 Apply on session name
324\-k, \-\-kernel
325 Apply to the kernel tracer
326\-u, \-\-userspace
327 Apply to the user-space tracer
328
329\-\-discard
330 Discard event when subbuffers are full (default)
331\-\-overwrite
332 Flight recorder mode : overwrites events when subbuffers are full
333\-\-subbuf-size SIZE
334 Subbuffer size in bytes {+k,+M,+G}
335 (default UST uid: 131072, UST pid: 4096, kernel: 262144, metadata: 4096)
336 Rounded up to the next power of 2.
337\-\-num-subbuf NUM
338 Number of subbuffers. (default UST uid: 4, UST pid: 4, kernel: 4, metadata: 2)
339 Rounded up to the next power of 2.
340\-\-switch-timer USEC
341 Switch subbuffer timer interval in µsec.
342 (default UST uid: 0, UST pid: 0, kernel: 0, metadata: 0)
343\-\-read-timer USEC
344 Read timer interval in µsec.
345 (default UST uid: 0, UST pid: 0, kernel: 200000, metadata: 0)
346\-\-output TYPE
347 Channel output type. Possible values: mmap, splice
348 (default UST uid: mmap, UST pid: mmap, kernel: splice, metadata: mmap)
349\-\-buffers-uid
350 Use per UID buffer (\-u only). Buffers are shared between applications
351 that have the same UID.
352\-\-buffers-pid
353 Use per PID buffer (\-u only). Each application has its own buffers.
354\-\-buffers-global
355 Use shared buffer for the whole system (\-k only)
356\-C, \-\-tracefile-size SIZE
357 Maximum size of each tracefile within a stream (in bytes).
358 0 means unlimited. (default: 0)
359\-W, \-\-tracefile-count COUNT
360 Used in conjunction with \-C option, this will limit the number
361 of files created to the specified count. 0 means unlimited. (default: 0)
362
363.B EXAMPLES:
364
365$ lttng enable-channel -C 4096 -W 32 chan1
366For each stream, the maximum size of a trace file will be 4096 bytes divided
367over a \fBmaximum\fP of 32 different files. The file count is appended after
368the stream number as seen in the following example. The last trace file is
369smaller than 4096 since it was not completely filled.
370
371 ~/lttng-traces/[...]/chan1_0_0 (4096)
372 ~/lttng-traces/[...]/chan1_0_1 (4096)
373 ~/lttng-traces/[...]/chan1_0_2 (3245)
374 ~/lttng-traces/[...]/chan1_1_0 (4096)
375 ...
376
377$ lttng enable-channel -C 4096
378This will create trace files of 4096 bytes and will create new ones as long as
379there is data available.
380.fi
381
382.IP
383
384.IP "\fBenable-event\fP NAME[,NAME2,...] [-k|-u] [OPTIONS]"
385.nf
386Enable tracing event
387
388A tracing event is always assigned to a channel. If \fB\-c, \-\-channel\fP is
389omitted, a default channel named '\fBchannel0\fP' is created and the event is
390added to it. For the user-space tracer, using \fB\-a, \-\-all\fP is the same as
391using the wildcard "*".
392
393If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
394file.
395.fi
396
397.B OPTIONS:
398
399.nf
400\-h, \-\-help
401 Show summary of possible options and commands.
402\-\-list-options
403 Simple listing of options
404\-s, \-\-session NAME
405 Apply on session name
406\-c, \-\-channel NAME
407 Apply on channel name
408\-a, \-\-all
409 Enable all tracepoints and syscalls. This actually enable a single
410 wildcard event "*".
411\-k, \-\-kernel
412 Apply for the kernel tracer
413\-u, \-\-userspace
414 Apply for the user-space tracer
415
416\-\-tracepoint
417 Tracepoint event (default)
418 - userspace tracer supports wildcards at end of string. Don't forget to
419 quote to deal with bash expansion.
420 e.g.:
421 "*"
422 "app_component:na*"
423\-\-loglevel NAME
424 Tracepoint loglevel range from 0 to loglevel. Listed in the help (\-h).
425\-\-loglevel-only NAME
426 Tracepoint loglevel (only this loglevel).
427
428 The loglevel or loglevel-only options should be combined with a
429 tracepoint name or tracepoint wildcard.
430\-\-probe [addr | symbol | symbol+offset]
431 Dynamic probe. Addr and offset can be octal (0NNN...), decimal (NNN...)
432 or hexadecimal (0xNNN...)
433\-\-function [addr | symbol | symbol+offset]
434 Dynamic function entry/return probe. Addr and offset can be octal
435 (0NNN...), decimal (NNN...) or hexadecimal (0xNNN...)
436\-\-syscall
437 System call event. Enabling syscalls tracing (kernel tracer), you will
438 not be able to disable them with disable-event. This is a known
439 limitation. You can disable the entire channel to do the trick.
440
441\-\-filter 'expression'
442 Set a filter on a newly enabled event. Filter expression on event
443 fields and context. Event recording depends on evaluation. Only
444 specify on first activation of a given event within a session.
445 Filter only allowed when enabling events within a session before
446 tracing is started. If the filter fails to link with the event
447 within the traced domain, the event will be discarded.
448 Currently, filter is only implemented for the user-space tracer.
449
450 Expression examples:
451
452 'intfield > 500 && intfield < 503'
453 '(stringfield == "test" || intfield != 10) && intfield > 33'
454 'doublefield > 1.1 && intfield < 5.3'
455
456 Wildcards are allowed at the end of strings:
457 'seqfield1 == "te*"'
458 In string literals, the escape character is a '\\'. Use '\\*' for
459 the '*' character, and '\\\\' for the '\\' character. Wildcard
460 match any sequence of characters, including an empty sub-string
461 (match 0 or more characters).
462
463 Context information can be used for filtering. The examples
464 below show usage of context filtering on process name (with a
465 wildcard), process ID range, and unique thread ID for filtering.
466 The process and thread ID of running applications can be found
467 under columns "PID" and "LWP" of the "ps -eLf" command.
468
469 '$ctx.procname == "demo*"'
470 '$ctx.vpid >= 4433 && $ctx.vpid < 4455'
471 '$ctx.vtid == 1234'
472.fi
473
474.IP "\fBdisable-channel\fP NAME[,NAME2,...] [\-k|\-u] [OPTIONS]"
475.nf
476Disable tracing channel
477
478Disabling a channel makes all event(s) in that channel to stop tracing. You can
479enable it back by calling \fBlttng enable-channel NAME\fP again.
480
481If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
482file.
483.fi
484
485.B OPTIONS:
486
487.nf
488\-h, \-\-help
489 Show summary of possible options and commands.
490\-\-list-options
491 Simple listing of options
492\-s, \-\-session NAME
493 Apply on session name
494\-k, \-\-kernel
495 Apply for the kernel tracer
496\-u, \-\-userspace
497 Apply for the user-space tracer
498.fi
499
500.IP "\fBdisable-event\fP NAME[,NAME2,...] [\-k|\-u] [OPTIONS]"
501.nf
502Disable tracing event
503
504The event, once disabled, can be re-enabled by calling \fBlttng enable-event
505NAME\fP again.
506
507If \fB\-s, \-\-session\fP is omitted, the session name is taken from the .lttngrc
508file.
509.fi
510
511.B OPTIONS:
512
513.nf
514\-h, \-\-help
515 Show summary of possible options and commands.
516\-\-list-options
517 Simple listing of options
518\-s, \-\-session NAME
519 Apply on session name
520\-a, \-\-all-events
521 Disable all events. This does NOT disable "*" but rather
522 every known events of the session.
523\-k, \-\-kernel
524 Apply for the kernel tracer
525\-u, \-\-userspace
526 Apply for the user-space tracer
527.fi
528
529.IP "\fBlist\fP [\-k|\-u] [SESSION [SESSION_OPTIONS]]"
530.nf
531List tracing session information.
532
533With no arguments, it will list available tracing session(s).
534
535With the session name, it will display the details of the session including
536the trace file path, the associated channels and their state (activated
537and deactivated), the activated events and more.
538
539With \-k alone, it will list all available kernel events (except the system
540calls events).
541With \-u alone, it will list all available user-space events from registered
542applications. Here is an example of 'lttng list \-u':
543
544PID: 7448 - Name: /tmp/lttng-ust/tests/hello/.libs/lt-hello
545 ust_tests_hello:tptest_sighandler (type: tracepoint)
546 ust_tests_hello:tptest (type: tracepoint)
547
548You can now enable any event listed by using the name :
549\fBust_tests_hello:tptest\fP.
550.fi
551
552.B OPTIONS:
553
554.nf
555\-h, \-\-help
556 Show summary of possible options and commands.
557\-\-list-options
558 Simple listing of options
559\-k, \-\-kernel
560 Select kernel domain
561\-u, \-\-userspace
562 Select user-space domain.
563
564.B SESSION OPTIONS:
565
566\-c, \-\-channel NAME
567 List details of a channel
568\-d, \-\-domain
569 List available domain(s)
570.fi
571
572.IP "\fBset-session\fP NAME"
573.nf
574Set current session name
575
576Will change the session name in the .lttngrc file.
577.fi
578
579.B OPTIONS:
580
581.nf
582\-h, \-\-help
583 Show summary of possible options and commands.
584\-\-list-options
585 Simple listing of options
586.fi
587
588.IP
589
590.IP "\fBstart\fP [NAME] [OPTIONS]"
591.nf
592Start tracing
593
594It will start tracing for all tracers for a specific tracing session.
595
596If NAME is omitted, the session name is taken from 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 "\fBstop\fP [NAME] [OPTIONS]"
611.nf
612Stop tracing
613
614It will stop tracing for all tracers for a specific tracing session. Before
615returning, the command checks for data availability meaning that it will wait
616until the trace is readable for the session. Use \-\-no-wait to avoid this
617behavior.
618
619If NAME is omitted, the session name is taken from the .lttngrc file.
620.fi
621
622.B OPTIONS:
623
624.nf
625\-h, \-\-help
626 Show summary of possible options and commands.
627\-\-list-options
628 Simple listing of options
629\-\-no-wait
630 Don't wait for data availability.
631.fi
632
633.IP
634
635.IP "\fBversion\fP"
636.nf
637Show version information
638.fi
639
640.B OPTIONS:
641
642.nf
643\-h, \-\-help
644 Show summary of possible options and commands.
645\-\-list-options
646 Simple listing of options
647.fi
648
649.IP
650
651.IP "\fBview\fP [SESSION_NAME] [OPTIONS]"
652.nf
653View traces of a tracing session
654
655By default, the babeltrace viewer will be used for text viewing.
656
657If SESSION_NAME is omitted, the session name is taken from the .lttngrc file.
658
659.fi
660
661.B OPTIONS:
662
663.nf
664\-h, \-\-help
665 Show this help
666\-\-list-options
667 Simple listing of options
668\-t, \-\-trace-path PATH
669 Trace directory path for the viewer
670\-e, \-\-viewer CMD
671 Specify viewer and/or options to use
672 This will completely override the default viewers so
673 please make sure to specify the full command. The trace
674 directory path of the session will be appended at the end
675 to the arguments
676.fi
677
678.SH "EXIT VALUES"
679On success 0 is returned and a positive value on error. Value of 1 means a command
680error, 2 an undefined command, 3 a fatal error and 4 a command warning meaning that
681something went wrong during the command.
682
683Any other value above 10, please refer to
684.BR <lttng/lttng-error.h>
685for a detailed list or use lttng_strerror() to get a human readable string of
686the error code.
687
688.PP
689.SH "ENVIRONMENT VARIABLES"
690
691.PP
692Note that all command line options override environment variables.
693.PP
694
695.PP
696.IP "LTTNG_SESSIOND_PATH"
697Allows one to specify the full session daemon binary path to lttng command line
698tool. You can also use \-\-sessiond-path option having the same effect.
699.SH "SEE ALSO"
700.BR babeltrace(1),
701.BR lttng-ust(3),
702.BR lttng-sessiond(8),
703.BR lttng-relayd(8),
704.BR lttng-health-check(3)
705.SH "BUGS"
706
707If you encounter any issues or usability problem, please report it on our
708mailing list <lttng-dev@lists.lttng.org> to help improve this project or
709at https://bugs.lttng.org which is a bugtracker.
710.SH "CREDITS"
711
712.PP
713lttng is distributed under the GNU General Public License version 2. See the file
714COPYING for details.
715.PP
716A Web site is available at http://lttng.org for more information on the LTTng
717project.
718.PP
719You can also find our git tree at http://git.lttng.org.
720.PP
721Mailing lists for support and development: <lttng-dev@lists.lttng.org>.
722.PP
723You can find us on IRC server irc.oftc.net (OFTC) in #lttng.
724.PP
725.SH "THANKS"
726
727.PP
728Thanks to Yannick Brosseau without whom this project would never have been so
729lean and mean! Also thanks to the Ericsson teams working on tracing which
730helped us greatly with detailed bug reports and unusual test cases.
731
732Thanks to our beloved packager Alexandre Montplaisir-Goncalves (Ubuntu and PPA
733maintainer) and Jon Bernard for our Debian packages.
734
735Special thanks to Michel Dagenais and the DORSAL laboratory at Polytechnique de
736Montreal for the LTTng journey.
737.PP
738.SH "AUTHORS"
739
740.PP
741lttng-tools was originally written by Mathieu Desnoyers, Julien Desfossez and
742David Goulet. More people have since contributed to it. It is currently
743maintained by David Goulet <dgoulet@efficios.com>.
744.PP
This page took 0.024346 seconds and 4 git commands to generate.