1bd4d1e03094bae0e5b50e84728e81a559be8f62
[lttng-ust.git] / doc / man / lttng-ust.3.txt
1 lttng-ust(3)
2 ============
3 :object-type: library
4
5
6 NAME
7 ----
8 lttng-ust - LTTng user space tracing
9
10
11 SYNOPSIS
12 --------
13 [verse]
14 *#include <lttng/tracepoint.h>*
15
16 [verse]
17 #define *TRACEPOINT_ENUM*('prov_name', 'enum_name', 'mappings')
18 #define *TRACEPOINT_EVENT*('prov_name', 't_name', 'args', 'fields')
19 #define *TRACEPOINT_EVENT_CLASS*('prov_name', 'class_name', 'args', 'fields')
20 #define *TRACEPOINT_EVENT_INSTANCE*('prov_name', 'class_name', 't_name', 'args')
21 #define *TRACEPOINT_LOGLEVEL*('prov_name', 't_name', 'level')
22 #define *ctf_array*('int_type', 'field_name', 'expr', 'count')
23 #define *ctf_array_nowrite*('int_type', 'field_name', 'expr', 'count')
24 #define *ctf_array_hex*('int_type', 'field_name', 'expr', 'count')
25 #define *ctf_array_nowrite_hex*('int_type', 'field_name', 'expr', 'count')
26 #define *ctf_array_network*('int_type', 'field_name', 'expr', 'count')
27 #define *ctf_array_network_nowrite*('int_type', 'field_name', 'expr', 'count')
28 #define *ctf_array_network_hex*('int_type', 'field_name', 'expr', 'count')
29 #define *ctf_array_network_nowrite_hex*('int_type', 'field_name', 'expr', 'count')
30 #define *ctf_array_text*(char, 'field_name', 'expr', 'count')
31 #define *ctf_array_text_nowrite*(char, 'field_name', 'expr', 'count')
32 #define *ctf_enum*('prov_name', 'enum_name', 'int_type', 'field_name', 'expr')
33 #define *ctf_enum_nowrite*('prov_name', 'enum_name', 'int_type', 'field_name',
34 'expr')
35 #define *ctf_enum_value*('label', 'value')
36 #define *ctf_enum_range*('label', 'start', 'end')
37 #define *ctf_float*('float_type', 'field_name', 'expr')
38 #define *ctf_float_nowrite*('float_type', 'field_name', 'expr')
39 #define *ctf_integer*('int_type', 'field_name', 'expr')
40 #define *ctf_integer_hex*('int_type', 'field_name', 'expr')
41 #define *ctf_integer_network*('int_type', 'field_name', 'expr')
42 #define *ctf_integer_network_hex*('int_type', 'field_name', 'expr')
43 #define *ctf_integer_nowrite*('int_type', 'field_name', 'expr')
44 #define *ctf_sequence*('int_type', 'field_name', 'expr', 'len_type', 'len_expr')
45 #define *ctf_sequence_nowrite*('int_type', 'field_name', 'expr', 'len_type',
46 'len_expr')
47 #define *ctf_sequence_hex*('int_type', 'field_name', 'expr', 'len_type',
48 'len_expr')
49 #define *ctf_sequence_nowrite_hex*('int_type', 'field_name', 'expr', 'len_type',
50 'len_expr')
51 #define *ctf_sequence_network*('int_type', 'field_name', 'expr', 'len_type',
52 'len_expr')
53 #define *ctf_sequence_network_nowrite*('int_type', 'field_name', 'expr',
54 'len_type', 'len_expr')
55 #define *ctf_sequence_network_hex*('int_type', 'field_name', 'expr', 'len_type',
56 'len_expr')
57 #define *ctf_sequence_network_nowrite_hex*('int_type', 'field_name', 'expr',
58 'len_type', 'len_expr')
59 #define *ctf_sequence_text*(char, 'field_name', 'expr', 'len_type', 'len_expr')
60 #define *ctf_sequence_text_nowrite*(char, 'field_name', 'expr', 'len_type',
61 'len_expr')
62 #define *ctf_string*('field_name', 'expr')
63 #define *ctf_string_nowrite*('field_name', 'expr')
64 #define *do_tracepoint*('prov_name', 't_name', ...)
65 #define *tracepoint*('prov_name', 't_name', ...)
66 #define *tracepoint_enabled*('prov_name', 't_name')
67
68 Link with `-llttng-ust -ldl`, following this man page.
69
70
71 DESCRIPTION
72 -----------
73 The http://lttng.org/[_Linux Trace Toolkit: next generation_] is an open
74 source software package used for correlated tracing of the Linux kernel,
75 user applications, and user libraries.
76
77 LTTng-UST is the user space tracing component of the LTTng project. It
78 is a port to user space of the low-overhead tracing capabilities of the
79 LTTng Linux kernel tracer. The `liblttng-ust` library is used to trace
80 user applications and libraries.
81
82 NOTE: This man page is about the `liblttng-ust` library. The LTTng-UST
83 project also provides Java and Python packages to trace applications
84 written in those languages. How to instrument and trace Java and Python
85 applications is documented in
86 http://lttng.org/docs/[the online LTTng documentation].
87
88 There are three ways to use `liblttng-ust`:
89
90 * Using the man:tracef(3) API, which is similar to man:printf(3).
91 * Using the man:tracelog(3) API, which is man:tracef(3) with
92 a log level parameter.
93 * Defining your own tracepoints. See the
94 <<creating-tp,Creating a tracepoint provider>> section below.
95
96
97 [[creating-tp]]
98 Creating a tracepoint provider
99 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100 Creating a tracepoint provider is the first step of using
101 `liblttng-ust`. The next steps are:
102
103 * <<tracepoint,Instrumenting your application with `tracepoint()` calls>>
104 * Building your application with LTTng-UST support, either
105 <<build-static,statically>> or <<build-dynamic,dynamically>>.
106
107 A *tracepoint provider* is a compiled object containing the event
108 probes corresponding to your custom tracepoint definitions. A tracepoint
109 provider contains the code to get the size of an event and to serialize
110 it, amongst other things.
111
112 To create a tracepoint provider, start with the following
113 _tracepoint provider header_ template:
114
115 ------------------------------------------------------------------------
116 #undef TRACEPOINT_PROVIDER
117 #define TRACEPOINT_PROVIDER my_provider
118
119 #undef TRACEPOINT_INCLUDE
120 #define TRACEPOINT_INCLUDE "./tp.h"
121
122 #if !defined(_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
123 #define _TP_H
124
125 #include <lttng/tracepoint.h>
126
127 /*
128 * TRACEPOINT_EVENT(), TRACEPOINT_EVENT_CLASS(),
129 * TRACEPOINT_EVENT_INSTANCE(), TRACEPOINT_LOGLEVEL(),
130 * and `TRACEPOINT_ENUM()` are used here.
131 */
132
133 #endif /* _TP_H */
134
135 #include <lttng/tracepoint-event.h>
136 ------------------------------------------------------------------------
137
138 In this template, the tracepoint provider is named `my_provider`
139 (`TRACEPOINT_PROVIDER` definition). The file needs to bear the
140 name of the `TRACEPOINT_INCLUDE` definition (`tp.h` in this case).
141 Between `#include <lttng/tracepoint.h>` and `#endif` go
142 the invocations of the <<tracepoint-event,`TRACEPOINT_EVENT()`>>,
143 <<tracepoint-event-class,`TRACEPOINT_EVENT_CLASS()`>>,
144 <<tracepoint-event-class,`TRACEPOINT_EVENT_INSTANCE()`>>,
145 <<tracepoint-loglevel,`TRACEPOINT_LOGLEVEL()`>>, and
146 <<tracepoint-enum,`TRACEPOINT_ENUM()`>> macros.
147
148 NOTE: You can avoid writing the prologue and epilogue boilerplate in the
149 template file above by using the man:lttng-gen-tp(1) tool shipped with
150 LTTng-UST.
151
152 The tracepoint provider header file needs to be included in a source
153 file which looks like this:
154
155 ------------------------------------------------------------------------
156 #define TRACEPOINT_CREATE_PROBES
157
158 #include "tp.h"
159 ------------------------------------------------------------------------
160
161 Together, those two files (let's call them `tp.h` and `tp.c`) form the
162 tracepoint provider sources, ready to be compiled.
163
164 You can create multiple tracepoint providers to be used in a single
165 application, but each one must have its own header file.
166
167 The <<tracepoint-event,`TRACEPOINT_EVENT()` usage>> section below
168 shows how to use the `TRACEPOINT_EVENT()` macro to define the actual
169 tracepoints in the tracepoint provider header file.
170
171 See the <<example,EXAMPLE>> section below for a complete example.
172
173
174 [[tracepoint-event]]
175 `TRACEPOINT_EVENT()` usage
176 ~~~~~~~~~~~~~~~~~~~~~~~~~~
177 The `TRACEPOINT_EVENT()` macro is used in a template provider
178 header file (see the <<creating-tp,Creating a tracepoint provider>>
179 section above) to define LTTng-UST tracepoints.
180
181 The `TRACEPOINT_EVENT()` usage template is as follows:
182
183 ------------------------------------------------------------------------
184 TRACEPOINT_EVENT(
185 /* Tracepoint provider name */
186 my_provider,
187
188 /* Tracepoint/event name */
189 my_tracepoint,
190
191 /* List of tracepoint arguments (input) */
192 TP_ARGS(
193 ...
194 ),
195
196 /* List of fields of eventual event (output) */
197 TP_FIELDS(
198 ...
199 )
200 )
201 ------------------------------------------------------------------------
202
203 The `TP_ARGS()` macro contains the input arguments of the tracepoint.
204 Those arguments can be used in the argument expressions of the output
205 fields defined in `TP_FIELDS()`.
206
207 The format of the `TP_ARGS()` parameters is: C type, then argument name;
208 repeat as needed, up to ten times. For example:
209
210 ------------------------------------------------------------------------
211 TP_ARGS(
212 int, my_int,
213 const char *, my_string,
214 FILE *, my_file,
215 double, my_float,
216 struct my_data *, my_data
217 )
218 ------------------------------------------------------------------------
219
220 The `TP_FIELDS()` macro contains the output fields of the tracepoint,
221 that is, the actual data that can be recorded in the payload of an
222 event emitted by this tracepoint.
223
224 The `TP_FIELDS()` macro contains a list of `ctf_*()` macros
225 :not: separated by commas. The available macros are documented in the
226 <<ctf-macros,Available `ctf_*()` field type macros>> section below.
227
228
229 [[ctf-macros]]
230 Available `ctf_*()` field type macros
231 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232 This section documents the available `ctf_*()` macros that can be
233 inserted in the `TP_FIELDS()` macro of the
234 <<tracepoint-event,`TRACEPOINT_EVENT()` macro>>.
235
236 Standard integer, displayed in base 10:
237
238 [verse]
239 *ctf_integer*('int_type', 'field_name', 'expr')
240 *ctf_integer_nowrite*('int_type', 'field_name', 'expr')
241
242 Standard integer, displayed in base 16:
243
244 [verse]
245 *ctf_integer_hex*('int_type', 'field_name', 'expr')
246
247 Integer in network byte order (big endian), displayed in base 10:
248
249 [verse]
250 *ctf_integer_network*('int_type', 'field_name', 'expr')
251
252 Integer in network byte order, displayed in base 16:
253
254 [verse]
255 *ctf_integer_network_hex*('int_type', 'field_name', 'expr')
256
257 Floating point number:
258
259 [verse]
260 *ctf_float*('float_type', 'field_name', 'expr')
261 *ctf_float_nowrite*('float_type', 'field_name', 'expr')
262
263 Null-terminated string:
264
265 [verse]
266 *ctf_string*('field_name', 'expr')
267 *ctf_string_nowrite*('field_name', 'expr')
268
269 Statically-sized array of integers (`_hex` versions displayed in
270 hexadecimal, `_network` versions in network byte order):
271
272 [verse]
273 *ctf_array*('int_type', 'field_name', 'expr', 'count')
274 *ctf_array_nowrite*('int_type', 'field_name', 'expr', 'count')
275 *ctf_array_hex*('int_type', 'field_name', 'expr', 'count')
276 *ctf_array_nowrite_hex*('int_type', 'field_name', 'expr', 'count')
277 *ctf_array_network*('int_type', 'field_name', 'expr', 'count')
278 *ctf_array_network_nowrite*('int_type', 'field_name', 'expr', 'count')
279 *ctf_array_network_hex*('int_type', 'field_name', 'expr', 'count')
280 *ctf_array_network_nowrite_hex*('int_type', 'field_name', 'expr', 'count')
281
282 Statically-sized array, printed as text; no need to be null-terminated:
283
284 [verse]
285 *ctf_array_text*(char, 'field_name', 'expr', 'count')
286 *ctf_array_text_nowrite*(char, 'field_name', 'expr', 'count')
287
288 Dynamically-sized array of integers (`_hex` versions displayed in
289 hexadecimal, `_network` versions in network byte order):
290
291 [verse]
292 *ctf_sequence*('int_type', 'field_name', 'expr', 'len_type', 'len_expr')
293 *ctf_sequence_nowrite*('int_type', 'field_name', 'expr', 'len_type', 'len_expr')
294 *ctf_sequence_hex*('int_type', 'field_name', 'expr', 'len_type', 'len_expr')
295 *ctf_sequence_nowrite_hex*('int_type', 'field_name', 'expr', 'len_type',
296 'len_expr')
297 *ctf_sequence_network*('int_type', 'field_name', 'expr', 'len_type', 'len_expr')
298 *ctf_sequence_network_nowrite*('int_type', 'field_name', 'expr', 'len_type',
299 'len_expr')
300 *ctf_sequence_network_hex*('int_type', 'field_name', 'expr', 'len_type',
301 'len_expr')
302 *ctf_sequence_network_nowrite_hex*('int_type', 'field_name', 'expr',
303 'len_type', 'len_expr')
304
305 Dynamically-sized array, displayed as text; no need to be null-terminated:
306
307 [verse]
308 *ctf_sequence_text*(char, 'field_name', 'expr', 'len_type', 'len_expr')
309 *ctf_sequence_text_nowrite*(char, 'field_name', 'expr', 'len_type', 'len_expr')
310
311 Enumeration. The enumeration field must be defined before using this
312 macro with the `TRACEPOINT_ENUM()` macro. See the
313 <<tracepoint-enum,`TRACEPOINT_ENUM()` usage>> section for more
314 information.
315
316 [verse]
317 *ctf_enum*('prov_name', 'enum_name', 'int_type', 'field_name', 'expr')
318 *ctf_enum_nowrite*('prov_name', 'enum_name', 'int_type', 'field_name', 'expr')
319
320 The parameters are:
321
322 'count'::
323 Number of elements in array/sequence. This must be known at
324 compile time.
325
326 'enum_name'::
327 Name of an enumeration field previously defined with the
328 `TRACEPOINT_ENUM()` macro. See the
329 <<tracepoint-enum,`TRACEPOINT_ENUM()` usage>> section for more
330 information.
331
332 'expr'::
333 C expression resulting in the field's value. This expression can
334 use one or more arguments passed to the tracepoint. The arguments
335 of a given tracepoint are defined in the `TP_ARGS()` macro (see
336 the <<creating-tp,Creating a tracepoint provider>> section above).
337
338 'field_name'::
339 Event field name (C identifier syntax, :not: a literal string).
340
341 'float_type'::
342 Float C type (`float` or `double`). The size of this type determines
343 the size of the floating point number field.
344
345 'int_type'::
346 Integer C type. The size of this type determines the size of the
347 integer/enumeration field.
348
349 'len_expr'::
350 C expression resulting in the sequence's length. This expression
351 can use one or more arguments passed to the tracepoint.
352
353 'len_type'::
354 Unsigned integer C type of sequence's length.
355
356 'prov_name'::
357 Tracepoint provider name. This must be the same as the tracepoint
358 provider name used in a previous field definition.
359
360 The `_nowrite` versions omit themselves from the recorded trace, but are
361 otherwise identical. Their primary purpose is to make some of the
362 event context available to the event filters without having to commit
363 the data to sub-buffers. See man:lttng-enable-event(1) to learn more
364 about dynamic event filtering.
365
366 See the <<example,EXAMPLE>> section below for a complete example.
367
368
369 [[tracepoint-enum]]
370 `TRACEPOINT_ENUM()` usage
371 ~~~~~~~~~~~~~~~~~~~~~~~~~
372 An enumeration field is a list of mappings between an integers, or a
373 range of integers, and strings (sometimes called _labels_ or
374 _enumerators_). Enumeration fields can be used to have a more compact
375 trace when the possible values for a field are limited.
376
377 An enumeration field is defined with the `TRACEPOINT_ENUM()` macro:
378
379 ------------------------------------------------------------------------
380 TRACEPOINT_ENUM(
381 /* Tracepoint provider name */
382 my_provider,
383
384 /* Enumeration name (unique in the whole tracepoint provider) */
385 my_enum,
386
387 /* Enumeration mappings */
388 TP_ENUM_VALUES(
389 ...
390 )
391 )
392 ------------------------------------------------------------------------
393
394 `TP_ENUM_VALUES()` contains a list of enumeration mappings, :not:
395 separated by commas. Two macros can be used in the `TP_ENUM_VALUES()`:
396 `ctf_enum_value()` and `ctf_enum_range()`.
397
398 `ctf_enum_value()` is a single value mapping:
399
400 [verse]
401 *ctf_enum_value*('label', 'value')
402
403 This macro maps the given 'label' string to the value 'value'.
404
405 `ctf_enum_range()` is a range mapping:
406
407 [verse]
408 *ctf_enum_range*('label', 'start', 'end')
409
410 This macro maps the given 'label' string to the range of integers from
411 'start' to 'end', inclusively. Range mappings may overlap, but the
412 behaviour is implementation-defined: each trace reader handles
413 overlapping ranges as it wishes.
414
415 See the <<example,EXAMPLE>> section below for a complete example.
416
417
418 [[tracepoint-event-class]]
419 `TRACEPOINT_EVENT_CLASS()` usage
420 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421 A *tracepoint class* is a class of tracepoints sharing the
422 same field types and names. A tracepoint instance is one instance of
423 such a declared tracepoint class, with its own event name.
424
425 LTTng-UST creates one event serialization function per tracepoint
426 class. Using `TRACEPOINT_EVENT()` creates one tracepoint class per
427 tracepoint definition, whereas using `TRACEPOINT_EVENT_CLASS()` and
428 `TRACEPOINT_EVENT_INSTANCE()` creates one tracepoint class, and one or
429 more tracepoint instances of this class. In other words, many
430 tracepoints can reuse the same serialization code. Reusing the same
431 code, when possible, can reduce cache pollution, thus improve
432 performance.
433
434 The `TRACEPOINT_EVENT_CLASS()` macro accepts the same parameters as
435 the `TRACEPOINT_EVENT()` macro, except that instead of an event name,
436 its second parameter is the _tracepoint class name_:
437
438 ------------------------------------------------------------------------
439 TRACEPOINT_EVENT_CLASS(
440 /* Tracepoint provider name */
441 my_provider,
442
443 /* Tracepoint class name */
444 my_tracepoint_class,
445
446 /* List of tracepoint arguments (input) */
447 TP_ARGS(
448 ...
449 ),
450
451 /* List of fields of eventual event (output) */
452 TP_FIELDS(
453 ...
454 )
455 )
456 ------------------------------------------------------------------------
457
458 Once the tracepoint class is defined, you can create as many tracepoint
459 instances as needed:
460
461 -------------------------------------------------------------------------
462 TRACEPOINT_EVENT_INSTANCE(
463 /* Tracepoint provider name */
464 my_provider,
465
466 /* Tracepoint class name */
467 my_tracepoint_class,
468
469 /* Tracepoint/event name */
470 my_tracepoint,
471
472 /* List of tracepoint arguments (input) */
473 TP_ARGS(
474 ...
475 )
476 )
477 ------------------------------------------------------------------------
478
479 As you can see, the `TRACEPOINT_EVENT_INSTANCE()` does not contain
480 the `TP_FIELDS()` macro, because they are defined at the
481 `TRACEPOINT_EVENT_CLASS()` level.
482
483 See the <<example,EXAMPLE>> section below for a complete example.
484
485
486 [[tracepoint-loglevel]]
487 `TRACEPOINT_LOGLEVEL()` usage
488 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
489 Optionally, a *log level* can be assigned to a defined tracepoint.
490 Assigning different levels of severity to tracepoints can be useful:
491 when controlling tracing sessions, you can choose to only enable
492 events falling into a specific log level range using the
493 nloption:--loglevel and nloption:--loglevel-only options of the
494 man:lttng-enable-event(1) command.
495
496 Log levels are assigned to tracepoints that are already defined using
497 the `TRACEPOINT_LOGLEVEL()` macro. The latter must be used after having
498 used `TRACEPOINT_EVENT()` or `TRACEPOINT_EVENT_INSTANCE()` for a given
499 tracepoint. The `TRACEPOINT_LOGLEVEL()` macro is used as follows:
500
501 ------------------------------------------------------------------------
502 TRACEPOINT_LOGLEVEL(
503 /* Tracepoint provider name */
504 my_provider,
505
506 /* Tracepoint/event name */
507 my_tracepoint,
508
509 /* Log level */
510 TRACE_INFO
511 )
512 ------------------------------------------------------------------------
513
514 The available log level definitions are:
515
516 include::log-levels.txt[]
517
518 See the <<example,EXAMPLE>> section below for a complete example.
519
520
521 [[tracepoint]]
522 Instrumenting your application
523 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
524 Once the tracepoint provider is created (see the
525 <<creating-tp,Creating a tracepoint provider>> section above), you can
526 instrument your application with the defined tracepoints thanks to the
527 `tracepoint()` macro:
528
529 [verse]
530 #define *tracepoint*('prov_name', 't_name', ...)
531
532 With:
533
534 'prov_name'::
535 Tracepoint provider name.
536
537 't_name'::
538 Tracepoint/event name.
539
540 `...`::
541 Tracepoint arguments, if any.
542
543 Make sure to include the tracepoint provider header file anywhere you
544 use `tracepoint()` for this provider.
545
546 NOTE: Even though LTTng-UST supports `tracepoint()` call site duplicates
547 having the same provider and tracepoint names, it is recommended to use
548 a provider/tracepoint name pair only once within the application source
549 code to help map events back to their call sites when analyzing the
550 trace.
551
552 Sometimes, arguments to the tracepoint are expensive to compute (take
553 call stack, for example). To avoid the computation when the tracepoint
554 is disabled, you can use the `tracepoint_enabled()` and
555 `do_tracepoint()` macros:
556
557 [verse]
558 #define *tracepoint_enabled*('prov_name', 't_name')
559 #define *do_tracepoint*('prov_name', 't_name', ...)
560
561 `tracepoint_enabled()` returns a non-zero value if the tracepoint
562 named 't_name' from the provider named 'prov_name' is enabled at
563 run time.
564
565 `do_tracepoint()` is like `tracepoint()`, except that it doesn't check
566 if the tracepoint is enabled. Using `tracepoint()` with
567 `tracepoint_enabled()` is dangerous since `tracepoint()` also contains
568 the `tracepoint_enabled()` check, thus a race condition is possible
569 in this situation:
570
571 ------------------------------------------------------------------------
572 if (tracepoint_enabled(my_provider, my_tracepoint)) {
573 stuff = prepare_stuff();
574 }
575
576 tracepoint(my_provider, my_tracepoint, stuff);
577 ------------------------------------------------------------------------
578
579 If the tracepoint is enabled after the condition, then `stuff` is not
580 prepared: the emitted event will either contain wrong data, or the
581 whole application could crash (segmentation fault, for example).
582
583 NOTE: Neither `tracepoint_enabled()` nor `do_tracepoint()` have
584 a `STAP_PROBEV()` call, so if you need it, you should emit this call
585 yourself.
586
587
588 [[build-static]]
589 Statically linking the tracepoint provider
590 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
591 With the static linking method, compiled tracepoint providers are copied
592 into the target application.
593
594 Define `TRACEPOINT_DEFINE` definition below the
595 `TRACEPOINT_CREATE_PROBES` definition in the tracepoint provider
596 source:
597
598 ------------------------------------------------------------------------
599 #define TRACEPOINT_CREATE_PROBES
600 #define TRACEPOINT_DEFINE
601
602 #include "tp.h"
603 ------------------------------------------------------------------------
604
605 Create the tracepoint provider object file:
606
607 [role="term"]
608 ----
609 $ cc -c -I. tp.c
610 ----
611
612 NOTE: Although an application instrumented with LTTng-UST tracepoints
613 can be compiled with a C++ compiler, tracepoint probes should be
614 compiled with a C compiler.
615
616 At this point, you _can_ archive this tracepoint provider object file,
617 possibly with other object files of your application or with other
618 tracepoint provider object files, as a static library:
619
620 [role="term"]
621 ----
622 $ ar rc tp.a tp.o
623 ----
624
625 Using a static library does have the advantage of centralising the
626 tracepoint providers objects so they can be shared between multiple
627 applications. This way, when the tracepoint provider is modified, the
628 source code changes don't have to be patched into each application's
629 source code tree. The applications need to be relinked after each
630 change, but need not to be otherwise recompiled (unless the tracepoint
631 provider's API changes).
632
633 Then, link your application with this object file (or with the static
634 library containing it) and with `liblttng-ust` and `libdl`
635 (`libc` on a BSD system):
636
637 [role="term"]
638 ----
639 $ cc -o app tp.o app.o -llttng-ust -ldl
640 ----
641
642
643 [[build-dynamic]]
644 Dynamically loading the tracepoint provider
645 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
646 The second approach to package the tracepoint provider is to use the
647 dynamic loader: the library and its member functions are explicitly
648 sought, loaded at run time.
649
650 In this scenario, the tracepoint provider is compiled as a shared
651 object.
652
653 The process to create the tracepoint provider shared object is pretty
654 much the same as the <<build-static,static linking method>>, except
655 that:
656
657 * Since the tracepoint provider is not part of the application,
658 `TRACEPOINT_DEFINE` must be defined, for each tracepoint
659 provider, in exactly one source file of the
660 _application_
661 * `TRACEPOINT_PROBE_DYNAMIC_LINKAGE` must be defined next
662 to `TRACEPOINT_DEFINE`
663
664 Regarding `TRACEPOINT_DEFINE` and `TRACEPOINT_PROBE_DYNAMIC_LINKAGE`,
665 the recommended practice is to use a separate C source file in your
666 application to define them, then include the tracepoint provider header
667 files afterwards. For example, as `tp-define.c`:
668
669 ------------------------------------------------------------------------
670 #define TRACEPOINT_DEFINE
671 #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
672
673 #include "tp.h"
674 ------------------------------------------------------------------------
675
676 The tracepoint provider object file used to create the shared library is
677 built like it is using the static linking method, but with the
678 nloption:-fpic option:
679
680 [role="term"]
681 ----
682 $ cc -c -fpic -I. tp.c
683 ----
684
685 It is then linked as a shared library like this:
686
687 [role="term"]
688 ----
689 $ cc -shared -Wl,--no-as-needed -o tp.so tp.o -llttng-ust
690 ----
691
692 This tracepoint provider shared object isn't linked with the user
693 application: it must be loaded manually. This is why the application is
694 built with no mention of this tracepoint provider, but still needs
695 libdl:
696
697 [role="term"]
698 ----
699 $ cc -o app app.o tp-define.o -ldl
700 ----
701
702 There are two ways to dynamically load the tracepoint provider shared
703 object:
704
705 * Load it manually from the application using man:dlopen(3)
706 * Make the dynamic loader load it with the `LD_PRELOAD`
707 environment variable (see man:ld.so(8))
708
709 If the application does not dynamically load the tracepoint provider
710 shared object using one of the methods above, tracing is disabled for
711 this application, and the events are not listed in the output of
712 man:lttng-list(1).
713
714 Note that it is not safe to use man:dlclose(3) on a tracepoint provider
715 shared object that is being actively used for tracing, due to a lack of
716 reference counting from LTTng-UST to the shared object.
717
718 For example, statically linking a tracepoint provider to a shared object
719 which is to be dynamically loaded by an application (a plugin, for
720 example) is not safe: the shared object, which contains the tracepoint
721 provider, could be dynamically closed (man:dlclose(3)) at any time by
722 the application.
723
724 To instrument a shared object, either:
725
726 * Statically link the tracepoint provider to the application, or
727 * Build the tracepoint provider as a shared object (following the
728 procedure shown in this section), and preload it when tracing is
729 needed using the `LD_PRELOAD` environment variable.
730
731
732 Using LTTng-UST with daemons
733 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
734 Some extra care is needed when using `liblttng-ust` with daemon
735 applications that call man:fork(2), man:clone(2), or BSD's man:rfork(2)
736 without a following man:exec(3) family system call. The library
737 `liblttng-ust-fork.so` needs to be preloaded before starting the
738 application with the `LD_PRELOAD` environment variable (see
739 man:ld.so(8)).
740
741 To use `liblttng-ust` with a daemon application which closes file
742 descriptors that were not opened by it, preload the `liblttng-ust-fd.so`
743 library before you start the application. Typical use cases include
744 daemons closing all file descriptors after man:fork(2), and buggy
745 applications doing ``double-closes''.
746
747
748 Context information
749 ~~~~~~~~~~~~~~~~~~~
750 Context information can be prepended by the LTTng-UST tracer before
751 each event, or before specific events.
752
753 Context fields can be added to specific channels using
754 man:lttng-add-context(1).
755
756 The following context fields are supported by LTTng-UST:
757
758 `cpu_id`::
759 CPU ID.
760 +
761 NOTE: This context field is always enabled, and it cannot be added
762 with man:lttng-add-context(1). Its main purpose is to be used for
763 dynamic event filtering. See man:lttng-enable-event(1) for more
764 information about event filtering.
765
766 `ip`::
767 Instruction pointer: enables recording the exact address from which
768 an event was emitted. This context field can be used to
769 reverse-lookup the source location that caused the event
770 to be emitted.
771
772 `perf:thread:COUNTER`::
773 perf counter named 'COUNTER'. Use `lttng add-context --list` to
774 list the available perf counters.
775 +
776 Only available on IA-32 and x86-64 architectures.
777
778 `perf:thread:raw:rN:NAME`::
779 perf counter with raw ID 'N' and custom name 'NAME'. See
780 man:lttng-add-context(1) for more details.
781
782 `pthread_id`::
783 POSIX thread identifier. Can be used on architectures where
784 `pthread_t` maps nicely to an `unsigned long` type.
785
786 `procname`::
787 Thread name, as set by man:exec(3) or man:prctl(2). It is
788 recommended that programs set their thread name with man:prctl(2)
789 before hitting the first tracepoint for that thread.
790
791 `vpid`::
792 Virtual process ID: process ID as seen from the point of view of
793 the current man:pid_namespaces(7).
794
795 `vtid`::
796 Virtual thread ID: thread ID as seen from the point of view of
797 the current man:pid_namespaces(7).
798
799 The following man:namespaces(7) context fields are supported by LTTng-UST:
800
801 `cgroup_ns`::
802 Cgroup root directory namespace: inode number of the current
803 man:cgroup_namespaces(7) in the proc filesystem.
804
805 `ipc_ns`::
806 System V IPC, POSIX message queues namespace: inode number of the
807 current IPC namespace in the proc filesystem.
808
809 `mnt_ns`::
810 Mount points namespace: inode number of the current Mount namespace
811 in the proc filesystem.
812
813 `net_ns`::
814 Network devices, stacks, ports namespace: inode number of the
815 current Network namespace in the proc filesystem.
816
817 `pid_ns`::
818 Process IDs namespace: inode number of the current
819 man:pid_namespaces(7) in the proc filesystem.
820
821 `user_ns`::
822 User and group IDs namespace: inode number of the current
823 man:user_namespaces(7) in the proc filesystem.
824
825 `uts_ns`::
826 Hostname and NIS domain name namespace: inode number of the
827 current UTS namespace in the proc filesystem.
828
829 The following man:credentials(7) context fields are supported by LTTng-UST:
830
831 `vuid`::
832 Virtual real user ID: real user ID as seen from the point of view of
833 the current man:user_namespaces(7).
834
835 `vgid`::
836 Virtual real group ID: real group ID as seen from the point of view of
837 the current man:user_namespaces(7).
838
839 `veuid`::
840 Virtual effective user ID: effective user ID as seen from the point of
841 view of the current man:user_namespaces(7).
842
843 `vegid`::
844 Virtual effective group ID: effective group ID as seen from the point of
845 view of the current man:user_namespaces(7).
846
847 `vsuid`::
848 Virtual saved set-user ID: saved set-user ID as seen from the point of
849 view of the current man:user_namespaces(7).
850
851 `vsgid`::
852 Virtual saved set-group ID: saved set-group ID as seen from the point of
853 view of the current man:user_namespaces(7).
854
855
856 [[state-dump]]
857 LTTng-UST state dump
858 ~~~~~~~~~~~~~~~~~~~~
859 If an application that uses `liblttng-ust` becomes part of a tracing
860 session, information about its currently loaded shared objects, their
861 build IDs, and their debug link information are emitted as events
862 by the tracer.
863
864 The following LTTng-UST state dump events exist and must be enabled
865 to record application state dumps. Note that, during the state dump
866 phase, LTTng-UST can also emit _shared library load/unload_ events
867 (see <<ust-lib,Shared library load/unload tracking>> below).
868
869 `lttng_ust_statedump:start`::
870 Emitted when the state dump begins.
871 +
872 This event has no fields.
873
874 `lttng_ust_statedump:end`::
875 Emitted when the state dump ends. Once this event is emitted, it
876 is guaranteed that, for a given process, the state dump is
877 complete.
878 +
879 This event has no fields.
880
881 `lttng_ust_statedump:bin_info`::
882 Emitted when information about a currently loaded executable or
883 shared object is found.
884 +
885 Fields:
886 +
887 [options="header"]
888 |===
889 |Field name |Description
890
891 |`baddr`
892 |Base address of loaded executable.
893
894 |`memsz`
895 |Size of loaded executable in memory.
896
897 |`path`
898 |Path to loaded executable file.
899
900 |`is_pic`
901 |Whether or not the executable is position-independent code.
902
903 |`has_build_id`
904 |Whether or not the executable has a build ID. If this field is 1, you
905 can expect that an `lttng_ust_statedump:build_id` event record follows
906 this one (not necessarily immediately after).
907
908 |`has_debug_link`
909 |Whether or not the executable has debug link information. If this field
910 is 1, you can expect that an `lttng_ust_statedump:debug_link` event
911 record follows this one (not necessarily immediately after).
912 |===
913
914 `lttng_ust_statedump:build_id`::
915 Emitted when a build ID is found in a currently loaded shared
916 library. See
917 https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html[Debugging Information in Separate Files]
918 for more information about build IDs.
919 +
920 Fields:
921 +
922 [options="header"]
923 |===
924 |Field name |Description
925
926 |`baddr`
927 |Base address of loaded library.
928
929 |`build_id`
930 |Build ID.
931 |===
932
933 `lttng_ust_statedump:debug_link`::
934 Emitted when debug link information is found in a currently loaded
935 shared library. See
936 https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html[Debugging Information in Separate Files]
937 for more information about debug links.
938 +
939 Fields:
940 +
941 [options="header"]
942 |===
943 |Field name |Description
944
945 |`baddr`
946 |Base address of loaded library.
947
948 |`crc`
949 |Debug link file's CRC.
950
951 |`filename`
952 |Debug link file name.
953 |===
954
955
956 [[ust-lib]]
957 Shared library load/unload tracking
958 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
959 The <<state-dump,LTTng-UST state dump>> and the LTTng-UST helper library
960 to instrument the dynamic linker (see man:liblttng-ust-dl(3)) can emit
961 **shared library load/unload tracking** events.
962
963 The following shared library load/unload tracking events exist and must
964 be enabled to track the loading and unloading of shared libraries:
965
966 `lttng_ust_lib:load`::
967 Emitted when a shared library (shared object) is loaded.
968 +
969 Fields:
970 +
971 [options="header"]
972 |===
973 |Field name |Description
974
975 |`baddr`
976 |Base address of loaded library.
977
978 |`memsz`
979 |Size of loaded library in memory.
980
981 |`path`
982 |Path to loaded library file.
983
984 |`has_build_id`
985 |Whether or not the library has a build ID. If this field is 1, you
986 can expect that an `lttng_ust_lib:build_id` event record follows
987 this one (not necessarily immediately after).
988
989 |`has_debug_link`
990 |Whether or not the library has debug link information. If this field
991 is 1, you can expect that an `lttng_ust_lib:debug_link` event
992 record follows this one (not necessarily immediately after).
993 |===
994
995 `lttng_ust_lib:unload`::
996 Emitted when a shared library (shared object) is unloaded.
997 +
998 Fields:
999 +
1000 [options="header"]
1001 |===
1002 |Field name |Description
1003
1004 |`baddr`
1005 |Base address of unloaded library.
1006 |===
1007
1008 `lttng_ust_lib:build_id`::
1009 Emitted when a build ID is found in a loaded shared library (shared
1010 object). See
1011 https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html[Debugging Information in Separate Files]
1012 for more information about build IDs.
1013 +
1014 Fields:
1015 +
1016 [options="header"]
1017 |===
1018 |Field name |Description
1019
1020 |`baddr`
1021 |Base address of loaded library.
1022
1023 |`build_id`
1024 |Build ID.
1025 |===
1026
1027 `lttng_ust_lib:debug_link`::
1028 Emitted when debug link information is found in a loaded
1029 shared library (shared object). See
1030 https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html[Debugging Information in Separate Files]
1031 for more information about debug links.
1032 +
1033 Fields:
1034 +
1035 [options="header"]
1036 |===
1037 |Field name |Description
1038
1039 |`baddr`
1040 |Base address of loaded library.
1041
1042 |`crc`
1043 |Debug link file's CRC.
1044
1045 |`filename`
1046 |Debug link file name.
1047 |===
1048
1049
1050 Detect if LTTng-UST is loaded
1051 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1052 To detect if `liblttng-ust` is loaded from an application:
1053
1054 . Define the `lttng_ust_loaded` weak symbol globally:
1055 +
1056 ------------------------------------------------------------------------
1057 int lttng_ust_loaded __attribute__((weak));
1058 ------------------------------------------------------------------------
1059 +
1060 This weak symbol is set by the constructor of `liblttng-ust`.
1061
1062 . Test `lttng_ust_loaded` where needed:
1063 +
1064 ------------------------------------------------------------------------
1065 /* ... */
1066
1067 if (lttng_ust_loaded) {
1068 /* LTTng-UST is loaded */
1069 } else {
1070 /* LTTng-UST is NOT loaded */
1071 }
1072
1073 /* ... */
1074 ------------------------------------------------------------------------
1075
1076
1077 [[example]]
1078 EXAMPLE
1079 -------
1080 NOTE: A few examples are available in the
1081 https://github.com/lttng/lttng-ust/tree/v{lttng_version}/doc/examples[`doc/examples`]
1082 directory of LTTng-UST's source tree.
1083
1084 This example shows all the features documented in the previous
1085 sections. The <<build-static,static linking>> method is chosen here
1086 to link the application with the tracepoint provider.
1087
1088 You can compile the source files and link them together statically
1089 like this:
1090
1091 [role="term"]
1092 ----
1093 $ cc -c -I. tp.c
1094 $ cc -c app.c
1095 $ cc -o app tp.o app.o -llttng-ust -ldl
1096 ----
1097
1098 Using the man:lttng(1) tool, create an LTTng tracing session, enable
1099 all the events of this tracepoint provider, and start tracing:
1100
1101 [role="term"]
1102 ----
1103 $ lttng create my-session
1104 $ lttng enable-event --userspace 'my_provider:*'
1105 $ lttng start
1106 ----
1107
1108 You may also enable specific events:
1109
1110 [role="term"]
1111 ----
1112 $ lttng enable-event --userspace my_provider:big_event
1113 $ lttng enable-event --userspace my_provider:event_instance2
1114 ----
1115
1116 Run the application:
1117
1118 [role="term"]
1119 ----
1120 $ ./app some arguments
1121 ----
1122
1123 Stop the current tracing session and inspect the recorded events:
1124
1125 [role="term"]
1126 ----
1127 $ lttng stop
1128 $ lttng view
1129 ----
1130
1131
1132 Tracepoint provider header file
1133 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1134 `tp.h`:
1135
1136 ------------------------------------------------------------------------
1137 #undef TRACEPOINT_PROVIDER
1138 #define TRACEPOINT_PROVIDER my_provider
1139
1140 #undef TRACEPOINT_INCLUDE
1141 #define TRACEPOINT_INCLUDE "./tp.h"
1142
1143 #if !defined(_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
1144 #define _TP_H
1145
1146 #include <lttng/tracepoint.h>
1147 #include <stdio.h>
1148
1149 #include "app.h"
1150
1151 TRACEPOINT_EVENT(
1152 my_provider,
1153 simple_event,
1154 TP_ARGS(
1155 int, my_integer_arg,
1156 const char *, my_string_arg
1157 ),
1158 TP_FIELDS(
1159 ctf_string(argc, my_string_arg)
1160 ctf_integer(int, argv, my_integer_arg)
1161 )
1162 )
1163
1164 TRACEPOINT_ENUM(
1165 my_provider,
1166 my_enum,
1167 TP_ENUM_VALUES(
1168 ctf_enum_value("ZERO", 0)
1169 ctf_enum_value("ONE", 1)
1170 ctf_enum_value("TWO", 2)
1171 ctf_enum_range("A RANGE", 52, 125)
1172 ctf_enum_value("ONE THOUSAND", 1000)
1173 )
1174 )
1175
1176 TRACEPOINT_EVENT(
1177 my_provider,
1178 big_event,
1179 TP_ARGS(
1180 int, my_integer_arg,
1181 const char *, my_string_arg,
1182 FILE *, stream,
1183 double, flt_arg,
1184 int *, array_arg
1185 ),
1186 TP_FIELDS(
1187 ctf_integer(int, int_field1, my_integer_arg * 2)
1188 ctf_integer_hex(long int, stream_pos, ftell(stream))
1189 ctf_float(double, float_field, flt_arg)
1190 ctf_string(string_field, my_string_arg)
1191 ctf_array(int, array_field, array_arg, 7)
1192 ctf_array_text(char, array_text_field, array_arg, 5)
1193 ctf_sequence(int, seq_field, array_arg, int,
1194 my_integer_arg / 10)
1195 ctf_sequence_text(char, seq_text_field, array_arg,
1196 int, my_integer_arg / 5)
1197 ctf_enum(my_provider, my_enum, int,
1198 enum_field, array_arg[1])
1199 )
1200 )
1201
1202 TRACEPOINT_LOGLEVEL(my_provider, big_event, TRACE_WARNING)
1203
1204 TRACEPOINT_EVENT_CLASS(
1205 my_provider,
1206 my_tracepoint_class,
1207 TP_ARGS(
1208 int, my_integer_arg,
1209 struct app_struct *, app_struct_arg
1210 ),
1211 TP_FIELDS(
1212 ctf_integer(int, a, my_integer_arg)
1213 ctf_integer(unsigned long, b, app_struct_arg->b)
1214 ctf_string(c, app_struct_arg->c)
1215 )
1216 )
1217
1218 TRACEPOINT_EVENT_INSTANCE(
1219 my_provider,
1220 my_tracepoint_class,
1221 event_instance1,
1222 TP_ARGS(
1223 int, my_integer_arg,
1224 struct app_struct *, app_struct_arg
1225 )
1226 )
1227
1228 TRACEPOINT_EVENT_INSTANCE(
1229 my_provider,
1230 my_tracepoint_class,
1231 event_instance2,
1232 TP_ARGS(
1233 int, my_integer_arg,
1234 struct app_struct *, app_struct_arg
1235 )
1236 )
1237
1238 TRACEPOINT_LOGLEVEL(my_provider, event_instance2, TRACE_INFO)
1239
1240 TRACEPOINT_EVENT_INSTANCE(
1241 my_provider,
1242 my_tracepoint_class,
1243 event_instance3,
1244 TP_ARGS(
1245 int, my_integer_arg,
1246 struct app_struct *, app_struct_arg
1247 )
1248 )
1249
1250 #endif /* _TP_H */
1251
1252 #include <lttng/tracepoint-event.h>
1253 ------------------------------------------------------------------------
1254
1255
1256 Tracepoint provider source file
1257 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1258 `tp.c`:
1259
1260 ------------------------------------------------------------------------
1261 #define TRACEPOINT_CREATE_PROBES
1262 #define TRACEPOINT_DEFINE
1263
1264 #include "tp.h"
1265 ------------------------------------------------------------------------
1266
1267
1268 Application header file
1269 ~~~~~~~~~~~~~~~~~~~~~~~
1270 `app.h`:
1271
1272 ------------------------------------------------------------------------
1273 #ifndef _APP_H
1274 #define _APP_H
1275
1276 struct app_struct {
1277 unsigned long b;
1278 const char *c;
1279 double d;
1280 };
1281
1282 #endif /* _APP_H */
1283 ------------------------------------------------------------------------
1284
1285
1286 Application source file
1287 ~~~~~~~~~~~~~~~~~~~~~~~
1288 `app.c`:
1289
1290 ------------------------------------------------------------------------
1291 #include <stdlib.h>
1292 #include <stdio.h>
1293
1294 #include "tp.h"
1295 #include "app.h"
1296
1297 static int array_of_ints[] = {
1298 100, -35, 1, 23, 14, -6, 28, 1001, -3000,
1299 };
1300
1301 int main(int argc, char* argv[])
1302 {
1303 FILE *stream;
1304 struct app_struct app_struct;
1305
1306 tracepoint(my_provider, simple_event, argc, argv[0]);
1307 stream = fopen("/tmp/app.txt", "w");
1308
1309 if (!stream) {
1310 fprintf(stderr,
1311 "Error: Cannot open /tmp/app.txt for writing\n");
1312 return EXIT_FAILURE;
1313 }
1314
1315 if (fprintf(stream, "0123456789") != 10) {
1316 fclose(stream);
1317 fprintf(stderr, "Error: Cannot write to /tmp/app.txt\n");
1318 return EXIT_FAILURE;
1319 }
1320
1321 tracepoint(my_provider, big_event, 35, "hello tracepoint",
1322 stream, -3.14, array_of_ints);
1323 fclose(stream);
1324 app_struct.b = argc;
1325 app_struct.c = "[the string]";
1326 tracepoint(my_provider, event_instance1, 23, &app_struct);
1327 app_struct.b = argc * 5;
1328 app_struct.c = "[other string]";
1329 tracepoint(my_provider, event_instance2, 17, &app_struct);
1330 app_struct.b = 23;
1331 app_struct.c = "nothing";
1332 tracepoint(my_provider, event_instance3, -52, &app_struct);
1333
1334 return EXIT_SUCCESS;
1335 }
1336 ------------------------------------------------------------------------
1337
1338
1339 ENVIRONMENT VARIABLES
1340 ---------------------
1341 `LTTNG_HOME`::
1342 Alternative user's home directory. This variable is useful when the
1343 user running the instrumented application has a non-writable home
1344 directory.
1345 +
1346 Unix sockets used for the communication between `liblttng-ust` and the
1347 LTTng session and consumer daemons (part of the LTTng-tools project)
1348 are located in a specific directory under `$LTTNG_HOME` (or `$HOME` if
1349 `$LTTNG_HOME` is not set).
1350
1351 `LTTNG_UST_ALLOW_BLOCKING`::
1352 If set, allow the application to retry event tracing when there's
1353 no space left for the event record in the sub-buffer, therefore
1354 effectively blocking the application until space is made available
1355 or the configured timeout is reached.
1356 +
1357 To allow an application to block during tracing, you also need to
1358 specify a blocking timeout when you create a channel with the
1359 nloption:--blocking-timeout option of the man:lttng-enable-channel(1)
1360 command.
1361 +
1362 This option can be useful in workloads generating very large trace data
1363 throughput, where blocking the application is an acceptable trade-off to
1364 prevent discarding event records.
1365 +
1366 WARNING: Setting this environment variable may significantly
1367 affect application timings.
1368
1369 `LTTNG_UST_CLOCK_PLUGIN`::
1370 Path to the shared object which acts as the clock override plugin.
1371 An example of such a plugin can be found in the LTTng-UST
1372 documentation under
1373 https://github.com/lttng/lttng-ust/tree/v{lttng_version}/doc/examples/clock-override[`examples/clock-override`].
1374
1375 `LTTNG_UST_DEBUG`::
1376 If set, enable `liblttng-ust`'s debug and error output.
1377
1378 `LTTNG_UST_GETCPU_PLUGIN`::
1379 Path to the shared object which acts as the `getcpu()` override
1380 plugin. An example of such a plugin can be found in the LTTng-UST
1381 documentation under
1382 https://github.com/lttng/lttng-ust/tree/v{lttng_version}/doc/examples/getcpu-override[`examples/getcpu-override`].
1383
1384 `LTTNG_UST_REGISTER_TIMEOUT`::
1385 Waiting time for the _registration done_ session daemon command
1386 before proceeding to execute the main program (milliseconds).
1387 +
1388 The value `0` means _do not wait_. The value `-1` means _wait forever_.
1389 Setting this environment variable to `0` is recommended for applications
1390 with time constraints on the process startup time.
1391 +
1392 Default: {lttng_ust_register_timeout}.
1393
1394 `LTTNG_UST_WITHOUT_BADDR_STATEDUMP`::
1395 If set, prevents `liblttng-ust` from performing a base address state
1396 dump (see the <<state-dump,LTTng-UST state dump>> section above).
1397
1398
1399 include::common-footer.txt[]
1400
1401 include::common-copyrights.txt[]
1402
1403 include::common-authors.txt[]
1404
1405
1406 SEE ALSO
1407 --------
1408 man:tracef(3),
1409 man:tracelog(3),
1410 man:lttng-gen-tp(1),
1411 man:lttng-ust-dl(3),
1412 man:lttng-ust-cyg-profile(3),
1413 man:lttng(1),
1414 man:lttng-enable-event(1),
1415 man:lttng-list(1),
1416 man:lttng-add-context(1),
1417 man:babeltrace(1),
1418 man:dlopen(3),
1419 man:ld.so(8)
This page took 0.055233 seconds and 3 git commands to generate.