1 #ifndef _LTTNG_UST_EVENTS_H
2 #define _LTTNG_UST_EVENTS_H
7 * Copyright 2010-2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Holds LTTng per-session event registry.
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <urcu/list.h>
31 #include <urcu/hlist.h>
34 #include <lttng/ust-config.h>
35 #include <lttng/ust-abi.h>
36 #include <lttng/ust-tracer.h>
37 #include <lttng/ust-endian.h>
44 #error "LTTNG_PACKED should be defined"
51 #define LTTNG_UST_UUID_LEN 16
54 * Tracepoint provider version. Compatibility based on the major number.
55 * Older tracepoint providers can always register to newer lttng-ust
56 * library, but the opposite is rejected: a newer tracepoint provider is
57 * rejected by an older lttng-ust library.
59 #define LTTNG_UST_PROVIDER_MAJOR 2
60 #define LTTNG_UST_PROVIDER_MINOR 0
64 struct lttng_ust_lib_ring_buffer_ctx
;
65 struct lttng_ust_context_app
;
66 struct lttng_event_field
;
67 struct lttng_event_notifier_group
;
70 * Data structures used by tracepoint event declarations, and by the
71 * tracer. Those structures have padding for future extension.
75 * LTTng client type enumeration. Used by the consumer to map the
76 * callbacks from its own address space.
78 enum lttng_client_types
{
79 LTTNG_CLIENT_METADATA
= 0,
80 LTTNG_CLIENT_DISCARD
= 1,
81 LTTNG_CLIENT_OVERWRITE
= 2,
82 LTTNG_CLIENT_DISCARD_RT
= 3,
83 LTTNG_CLIENT_OVERWRITE_RT
= 4,
84 LTTNG_NR_CLIENT_TYPES
,
87 /* Type description */
89 /* Update the astract_types name table in lttng-types.c along with this enum */
90 enum lttng_abstract_types
{
92 atype_enum
, /* legacy */
93 atype_array
, /* legacy */
94 atype_sequence
, /* legacy */
98 atype_struct
, /* legacy */
100 atype_array_nestable
,
101 atype_sequence_nestable
,
102 atype_struct_nestable
,
106 /* Update the string_encodings name table in lttng-types.c along with this enum */
107 enum lttng_string_encodings
{
108 lttng_encode_none
= 0,
109 lttng_encode_UTF8
= 1,
110 lttng_encode_ASCII
= 2,
114 struct lttng_enum_value
{
115 unsigned long long value
;
116 unsigned int signedness
:1;
119 enum lttng_enum_entry_options
{
120 LTTNG_ENUM_ENTRY_OPTION_IS_AUTO
= 1U << 0,
123 #define LTTNG_UST_ENUM_ENTRY_PADDING 16
124 struct lttng_enum_entry
{
125 struct lttng_enum_value start
, end
; /* start and end are inclusive */
129 unsigned int options
;
130 } LTTNG_PACKED extra
;
131 char padding
[LTTNG_UST_ENUM_ENTRY_PADDING
];
135 #define __type_integer(_type, _byte_order, _base, _encoding) \
137 .atype = atype_integer, \
142 .size = sizeof(_type) * CHAR_BIT, \
143 .alignment = lttng_alignof(_type) * CHAR_BIT, \
144 .signedness = lttng_is_signed_type(_type), \
145 .reverse_byte_order = _byte_order != BYTE_ORDER, \
147 .encoding = lttng_encode_##_encoding, \
152 #define LTTNG_UST_INTEGER_TYPE_PADDING 24
153 struct lttng_integer_type
{
154 unsigned int size
; /* in bits */
155 unsigned short alignment
; /* in bits */
156 unsigned int signedness
:1;
157 unsigned int reverse_byte_order
:1;
158 unsigned int base
; /* 2, 8, 10, 16, for pretty print */
159 enum lttng_string_encodings encoding
;
160 char padding
[LTTNG_UST_INTEGER_TYPE_PADDING
];
164 * Only float and double are supported. long double is not supported at
167 #define _float_mant_dig(_type) \
168 (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \
169 : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \
172 #define __type_float(_type) \
174 .atype = atype_float, \
179 .exp_dig = sizeof(_type) * CHAR_BIT \
180 - _float_mant_dig(_type), \
181 .mant_dig = _float_mant_dig(_type), \
182 .alignment = lttng_alignof(_type) * CHAR_BIT, \
183 .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
188 #define LTTNG_UST_FLOAT_TYPE_PADDING 24
189 struct lttng_float_type
{
190 unsigned int exp_dig
; /* exponent digits, in bits */
191 unsigned int mant_dig
; /* mantissa digits, in bits */
192 unsigned short alignment
; /* in bits */
193 unsigned int reverse_byte_order
:1;
194 char padding
[LTTNG_UST_FLOAT_TYPE_PADDING
];
198 #define LTTNG_UST_BASIC_TYPE_PADDING 128
199 union _lttng_basic_type
{
200 struct lttng_integer_type integer
; /* legacy */
202 const struct lttng_enum_desc
*desc
; /* Enumeration mapping */
203 struct lttng_integer_type container_type
;
204 } enumeration
; /* legacy */
206 enum lttng_string_encodings encoding
;
207 } string
; /* legacy */
208 struct lttng_float_type _float
; /* legacy */
209 char padding
[LTTNG_UST_BASIC_TYPE_PADDING
];
213 struct lttng_basic_type
{
214 enum lttng_abstract_types atype
;
216 union _lttng_basic_type basic
;
220 #define LTTNG_UST_TYPE_PADDING 128
222 enum lttng_abstract_types atype
;
224 /* provider ABI 2.0 */
225 struct lttng_integer_type integer
;
226 struct lttng_float_type _float
;
228 enum lttng_string_encodings encoding
;
231 const struct lttng_enum_desc
*desc
; /* Enumeration mapping */
232 struct lttng_type
*container_type
;
235 const struct lttng_type
*elem_type
;
236 unsigned int length
; /* Num. elems. */
237 unsigned int alignment
;
240 const char *length_name
; /* Length field name. */
241 const struct lttng_type
*elem_type
;
242 unsigned int alignment
; /* Alignment before elements. */
245 unsigned int nr_fields
;
246 const struct lttng_event_field
*fields
; /* Array of fields. */
247 unsigned int alignment
;
251 /* legacy provider ABI 1.0 */
252 union _lttng_basic_type basic
; /* legacy */
254 struct lttng_basic_type elem_type
;
255 unsigned int length
; /* Num. elems. */
256 } array
; /* legacy */
258 struct lttng_basic_type length_type
;
259 struct lttng_basic_type elem_type
;
260 } sequence
; /* legacy */
262 unsigned int nr_fields
;
263 struct lttng_event_field
*fields
; /* Array of fields. */
264 } _struct
; /* legacy */
266 char padding
[LTTNG_UST_TYPE_PADDING
];
270 #define LTTNG_UST_ENUM_TYPE_PADDING 24
271 struct lttng_enum_desc
{
273 const struct lttng_enum_entry
*entries
;
274 unsigned int nr_entries
;
275 char padding
[LTTNG_UST_ENUM_TYPE_PADDING
];
279 * Event field description
281 * IMPORTANT: this structure is part of the ABI between the probe and
282 * UST. Fields need to be only added at the end, never reordered, never
286 #define LTTNG_UST_EVENT_FIELD_PADDING 28
287 struct lttng_event_field
{
289 struct lttng_type type
;
290 unsigned int nowrite
; /* do not write into trace */
293 unsigned int nofilter
:1; /* do not consider for filter */
295 char padding
[LTTNG_UST_EVENT_FIELD_PADDING
];
299 enum lttng_ust_dynamic_type
{
300 LTTNG_UST_DYNAMIC_TYPE_NONE
,
301 LTTNG_UST_DYNAMIC_TYPE_S8
,
302 LTTNG_UST_DYNAMIC_TYPE_S16
,
303 LTTNG_UST_DYNAMIC_TYPE_S32
,
304 LTTNG_UST_DYNAMIC_TYPE_S64
,
305 LTTNG_UST_DYNAMIC_TYPE_U8
,
306 LTTNG_UST_DYNAMIC_TYPE_U16
,
307 LTTNG_UST_DYNAMIC_TYPE_U32
,
308 LTTNG_UST_DYNAMIC_TYPE_U64
,
309 LTTNG_UST_DYNAMIC_TYPE_FLOAT
,
310 LTTNG_UST_DYNAMIC_TYPE_DOUBLE
,
311 LTTNG_UST_DYNAMIC_TYPE_STRING
,
312 _NR_LTTNG_UST_DYNAMIC_TYPES
,
315 struct lttng_ctx_value
{
316 enum lttng_ust_dynamic_type sel
;
325 struct lttng_perf_counter_field
;
327 #define LTTNG_UST_CTX_FIELD_PADDING 40
328 struct lttng_ctx_field
{
329 struct lttng_event_field event_field
;
330 size_t (*get_size
)(struct lttng_ctx_field
*field
, size_t offset
);
331 void (*record
)(struct lttng_ctx_field
*field
,
332 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
333 struct lttng_channel
*chan
);
334 void (*get_value
)(struct lttng_ctx_field
*field
,
335 struct lttng_ctx_value
*value
);
337 struct lttng_perf_counter_field
*perf_counter
;
338 char padding
[LTTNG_UST_CTX_FIELD_PADDING
];
340 void (*destroy
)(struct lttng_ctx_field
*field
);
341 char *field_name
; /* Has ownership, dynamically allocated. */
344 #define LTTNG_UST_CTX_PADDING 20
346 struct lttng_ctx_field
*fields
;
347 unsigned int nr_fields
;
348 unsigned int allocated_fields
;
349 unsigned int largest_align
;
350 char padding
[LTTNG_UST_CTX_PADDING
];
353 #define LTTNG_UST_EVENT_DESC_PADDING 40
354 struct lttng_event_desc
{
356 void (*probe_callback
)(void);
357 const struct lttng_event_ctx
*ctx
; /* context */
358 const struct lttng_event_field
*fields
; /* event payload */
359 unsigned int nr_fields
;
360 const int **loglevel
;
361 const char *signature
; /* Argument types/names received */
364 const char **model_emf_uri
;
365 void (*event_notifier_callback
)(void);
367 char padding
[LTTNG_UST_EVENT_DESC_PADDING
];
371 #define LTTNG_UST_PROBE_DESC_PADDING 12
372 struct lttng_probe_desc
{
373 const char *provider
;
374 const struct lttng_event_desc
**event_desc
;
375 unsigned int nr_events
;
376 struct cds_list_head head
; /* chain registered probes */
377 struct cds_list_head lazy_init_head
;
378 int lazy
; /* lazy registration */
381 char padding
[LTTNG_UST_PROBE_DESC_PADDING
];
384 /* Data structures used by the tracer. */
386 enum lttng_enabler_format_type
{
387 LTTNG_ENABLER_FORMAT_STAR_GLOB
,
388 LTTNG_ENABLER_FORMAT_EVENT
,
392 * Enabler field, within whatever object is enabling an event. Target of
393 * backward reference.
395 struct lttng_enabler
{
396 enum lttng_enabler_format_type format_type
;
398 /* head list of struct lttng_ust_filter_bytecode_node */
399 struct cds_list_head filter_bytecode_head
;
400 /* head list of struct lttng_ust_excluder_node */
401 struct cds_list_head excluder_head
;
403 struct lttng_ust_event event_param
;
404 unsigned int enabled
:1;
407 struct tp_list_entry
{
408 struct lttng_ust_tracepoint_iter tp
;
409 struct cds_list_head head
;
412 struct lttng_ust_tracepoint_list
{
413 struct tp_list_entry
*iter
;
414 struct cds_list_head head
;
417 struct tp_field_list_entry
{
418 struct lttng_ust_field_iter field
;
419 struct cds_list_head head
;
422 struct lttng_ust_field_list
{
423 struct tp_field_list_entry
*iter
;
424 struct cds_list_head head
;
427 struct ust_pending_probe
;
431 * Bytecode interpreter return value masks.
433 enum lttng_bytecode_interpreter_ret
{
434 LTTNG_INTERPRETER_DISCARD
= 0,
435 LTTNG_INTERPRETER_RECORD_FLAG
= (1ULL << 0),
436 /* Other bits are kept for future use. */
439 struct lttng_interpreter_output
;
442 * This structure is used in the probes. More specifically, the `filter` and
443 * `node` fields are explicity used in the probes. When modifying this
444 * structure we must not change the layout of these two fields as it is
447 struct lttng_bytecode_runtime
{
448 /* Associated bytecode */
449 struct lttng_ust_bytecode_node
*bc
;
451 uint64_t (*filter
)(void *interpreter_data
,
452 const char *interpreter_stack_data
);
453 uint64_t (*capture
)(void *interpreter_data
,
454 const char *interpreter_stack_data
,
455 struct lttng_interpreter_output
*interpreter_output
);
458 struct cds_list_head node
; /* list of bytecode runtime in event */
460 * Pointer to a URCU-protected pointer owned by an `struct
461 * lttng_session`or `struct lttng_event_notifier_group`.
463 struct lttng_ctx
**pctx
;
467 * Objects in a linked-list of enablers, owned by an event or event_notifier.
468 * This is used because an event (or a event_notifier) can be enabled by more
469 * than one enabler and we want a quick way to iterate over all enablers of an
472 * For example, event rules "my_app:a*" and "my_app:ab*" will both match the
473 * event with the name "my_app:abc".
475 struct lttng_enabler_ref
{
476 struct cds_list_head node
; /* enabler ref list */
477 struct lttng_enabler
*ref
; /* backward ref */
481 * lttng_event structure is referred to by the tracing fast path. It
482 * must be kept small.
484 * IMPORTANT: this structure is part of the ABI between the probe and
485 * UST. Fields need to be only added at the end, never reordered, never
489 /* LTTng-UST 2.0 starts here */
491 struct lttng_channel
*chan
;
493 const struct lttng_event_desc
*desc
;
495 struct lttng_ctx
*ctx
;
496 enum lttng_ust_instrumentation instrumentation
;
497 struct cds_list_head node
; /* Event list in session */
498 struct cds_list_head _deprecated2
;
500 unsigned int _deprecated4
:1;
502 /* LTTng-UST 2.1 starts here */
503 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
504 struct cds_list_head filter_bytecode_runtime_head
;
505 int has_enablers_without_bytecode
;
506 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
507 struct cds_list_head enablers_ref_head
;
508 struct cds_hlist_node hlist
; /* session ht of events */
509 int registered
; /* has reg'd tracepoint probe */
512 struct lttng_event_notifier
{
514 uint64_t error_counter_index
;
516 int registered
; /* has reg'd tracepoint probe */
517 size_t num_captures
; /* Needed to allocate the msgpack array. */
518 struct cds_list_head filter_bytecode_runtime_head
;
519 struct cds_list_head capture_bytecode_runtime_head
;
520 int has_enablers_without_bytecode
;
521 struct cds_list_head enablers_ref_head
;
522 const struct lttng_event_desc
*desc
;
523 struct cds_hlist_node hlist
; /* hashtable of event_notifiers */
524 struct cds_list_head node
; /* event_notifier list in session */
525 struct lttng_event_notifier_group
*group
; /* weak ref */
529 const struct lttng_enum_desc
*desc
;
530 struct lttng_session
*session
;
531 struct cds_list_head node
; /* Enum list in session */
532 struct cds_hlist_node hlist
; /* Session ht of enums */
533 uint64_t id
; /* Enumeration ID in sessiond */
537 struct lttng_ust_shm_handle
;
540 * IMPORTANT: this structure is part of the ABI between the probe and
541 * UST. Fields need to be only added at the end, never reordered, never
544 struct lttng_channel_ops
{
545 struct lttng_channel
*(*channel_create
)(const char *name
,
547 size_t subbuf_size
, size_t num_subbuf
,
548 unsigned int switch_timer_interval
,
549 unsigned int read_timer_interval
,
552 const int *stream_fds
, int nr_stream_fds
,
553 int64_t blocking_timeout
);
554 void (*channel_destroy
)(struct lttng_channel
*chan
);
558 * has_strcpy is needed by probe providers version 1.0 to
559 * dynamically detect whether the LTTng-UST tracepoint
560 * provider ABI implements event_strcpy. Starting from
561 * probe providers version 2.0, the check is not needed,
562 * but backward compatibility is provided for older versions.
564 unsigned long has_strcpy
:1; /* ABI has strcpy */
567 int (*event_reserve
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
569 void (*event_commit
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
);
570 void (*event_write
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
571 const void *src
, size_t len
);
573 * packet_avail_size returns the available size in the current
574 * packet. Note that the size returned is only a hint, since it
575 * may change due to concurrent writes.
577 size_t (*packet_avail_size
)(struct channel
*chan
,
578 struct lttng_ust_shm_handle
*handle
);
579 //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
580 //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
581 int (*is_finalized
)(struct channel
*chan
);
582 int (*is_disabled
)(struct channel
*chan
);
583 int (*flush_buffer
)(struct channel
*chan
, struct lttng_ust_shm_handle
*handle
);
584 void (*event_strcpy
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
585 const char *src
, size_t len
);
589 * IMPORTANT: this structure is part of the ABI between the probe and
590 * UST. Fields need to be only added at the end, never reordered, never
593 struct lttng_channel
{
595 * The pointers located in this private data are NOT safe to be
596 * dereferenced by the consumer. The only operations the
597 * consumer process is designed to be allowed to do is to read
598 * and perform subbuffer flush.
600 struct channel
*chan
; /* Channel buffers */
602 struct lttng_ctx
*ctx
;
603 /* Event ID management */
604 struct lttng_session
*session
;
605 int objd
; /* Object associated to channel */
606 unsigned int _deprecated1
;
607 unsigned int _deprecated2
;
608 struct cds_list_head node
; /* Channel list in session */
609 const struct lttng_channel_ops
*ops
;
610 int header_type
; /* 0: unset, 1: compact, 2: large */
611 struct lttng_ust_shm_handle
*handle
; /* shared-memory handle */
612 unsigned int _deprecated3
:1;
616 enum lttng_ust_chan_type type
;
617 unsigned char uuid
[LTTNG_UST_UUID_LEN
]; /* Trace session unique ID */
618 int tstate
:1; /* Transient enable state */
621 #define LTTNG_COUNTER_DIMENSION_MAX 8
623 struct lttng_counter_dimension
{
625 uint64_t underflow_index
;
626 uint64_t overflow_index
;
627 uint8_t has_underflow
;
628 uint8_t has_overflow
;
631 struct lttng_counter_ops
{
632 struct lib_counter
*(*counter_create
)(size_t nr_dimensions
,
633 const struct lttng_counter_dimension
*dimensions
,
634 int64_t global_sum_step
,
635 int global_counter_fd
,
636 int nr_counter_cpu_fds
,
637 const int *counter_cpu_fds
,
639 void (*counter_destroy
)(struct lib_counter
*counter
);
640 int (*counter_add
)(struct lib_counter
*counter
,
641 const size_t *dimension_indexes
, int64_t v
);
642 int (*counter_read
)(struct lib_counter
*counter
,
643 const size_t *dimension_indexes
, int cpu
,
644 int64_t *value
, bool *overflow
, bool *underflow
);
645 int (*counter_aggregate
)(struct lib_counter
*counter
,
646 const size_t *dimension_indexes
, int64_t *value
,
647 bool *overflow
, bool *underflow
);
648 int (*counter_clear
)(struct lib_counter
*counter
, const size_t *dimension_indexes
);
651 #define LTTNG_UST_STACK_CTX_PADDING 32
652 struct lttng_stack_ctx
{
653 struct lttng_event
*event
;
654 struct lttng_ctx
*chan_ctx
; /* RCU dereferenced. */
655 struct lttng_ctx
*event_ctx
; /* RCU dereferenced. */
656 char padding
[LTTNG_UST_STACK_CTX_PADDING
];
659 #define LTTNG_UST_EVENT_HT_BITS 12
660 #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
662 struct lttng_ust_event_ht
{
663 struct cds_hlist_head table
[LTTNG_UST_EVENT_HT_SIZE
];
666 #define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12
667 #define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS)
668 struct lttng_ust_event_notifier_ht
{
669 struct cds_hlist_head table
[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE
];
672 #define LTTNG_UST_ENUM_HT_BITS 12
673 #define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS)
675 struct lttng_ust_enum_ht
{
676 struct cds_hlist_head table
[LTTNG_UST_ENUM_HT_SIZE
];
680 * IMPORTANT: this structure is part of the ABI between the probe and
681 * UST. Fields need to be only added at the end, never reordered, never
684 struct lttng_session
{
685 int active
; /* Is trace session active ? */
686 int been_active
; /* Been active ? */
687 int objd
; /* Object associated */
689 struct cds_list_head chan_head
; /* Channel list head */
690 struct cds_list_head events_head
; /* list of events */
691 struct cds_list_head _deprecated2
;
692 struct cds_list_head node
; /* Session list */
694 unsigned int _deprecated4
:1;
697 /* List of enablers */
698 struct cds_list_head enablers_head
;
699 struct lttng_ust_event_ht events_ht
; /* ht of events */
700 void *owner
; /* object owner */
701 int tstate
:1; /* Transient enable state */
704 int statedump_pending
:1;
707 struct lttng_ust_enum_ht enums_ht
; /* ht of enumerations */
708 struct cds_list_head enums_head
;
709 struct lttng_ctx
*ctx
; /* contexts for filters. */
712 struct lttng_counter
{
714 struct lttng_event_notifier_group
*event_notifier_group
; /* owner */
715 struct lttng_counter_transport
*transport
;
716 struct lib_counter
*counter
;
717 struct lttng_counter_ops
*ops
;
720 struct lttng_event_notifier_group
{
724 struct cds_list_head node
; /* Event notifier group handle list */
725 struct cds_list_head enablers_head
;
726 struct cds_list_head event_notifiers_head
; /* list of event_notifiers */
727 struct lttng_ust_event_notifier_ht event_notifiers_ht
; /* hashtable of event_notifiers */
728 struct lttng_ctx
*ctx
; /* contexts for filters. */
730 struct lttng_counter
*error_counter
;
731 size_t error_counter_len
;
734 struct lttng_transport
{
736 struct cds_list_head node
;
737 struct lttng_channel_ops ops
;
738 const struct lttng_ust_lib_ring_buffer_config
*client_config
;
741 struct lttng_counter_transport
{
743 struct cds_list_head node
;
744 struct lttng_counter_ops ops
;
745 const struct lib_counter_config
*client_config
;
748 struct lttng_session
*lttng_session_create(void);
749 int lttng_session_enable(struct lttng_session
*session
);
750 int lttng_session_disable(struct lttng_session
*session
);
751 int lttng_session_statedump(struct lttng_session
*session
);
752 void lttng_session_destroy(struct lttng_session
*session
);
754 void lttng_event_notifier_notification_send(
755 struct lttng_event_notifier
*event_notifier
,
756 const char *stack_data
);
758 struct lttng_channel
*lttng_channel_create(struct lttng_session
*session
,
759 const char *transport_name
,
761 size_t subbuf_size
, size_t num_subbuf
,
762 unsigned int switch_timer_interval
,
763 unsigned int read_timer_interval
,
764 int **shm_fd
, int **wait_fd
,
765 uint64_t **memory_map_size
,
766 struct lttng_channel
*chan_priv_init
);
768 int lttng_channel_enable(struct lttng_channel
*channel
);
769 int lttng_channel_disable(struct lttng_channel
*channel
);
771 int lttng_attach_context(struct lttng_ust_context
*context_param
,
772 union ust_args
*uargs
,
773 struct lttng_ctx
**ctx
, struct lttng_session
*session
);
774 void lttng_transport_register(struct lttng_transport
*transport
);
775 void lttng_transport_unregister(struct lttng_transport
*transport
);
777 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
);
778 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
);
780 struct lttng_counter
*lttng_ust_counter_create(
781 const char *counter_transport_name
,
782 size_t number_dimensions
, const struct lttng_counter_dimension
*dimensions
);
784 int lttng_probe_register(struct lttng_probe_desc
*desc
);
785 void lttng_probe_unregister(struct lttng_probe_desc
*desc
);
786 void lttng_probe_provider_unregister_events(struct lttng_probe_desc
*desc
);
787 int lttng_fix_pending_events(void);
788 int lttng_probes_init(void);
789 void lttng_probes_exit(void);
790 int lttng_find_context(struct lttng_ctx
*ctx
, const char *name
);
791 int lttng_get_context_index(struct lttng_ctx
*ctx
, const char *name
);
792 struct lttng_ctx_field
*lttng_append_context(struct lttng_ctx
**ctx_p
);
793 void lttng_context_update(struct lttng_ctx
*ctx
);
794 void lttng_remove_context_field(struct lttng_ctx
**ctx_p
,
795 struct lttng_ctx_field
*field
);
796 void lttng_destroy_context(struct lttng_ctx
*ctx
);
797 int lttng_add_vtid_to_ctx(struct lttng_ctx
**ctx
);
798 int lttng_add_vpid_to_ctx(struct lttng_ctx
**ctx
);
799 int lttng_add_pthread_id_to_ctx(struct lttng_ctx
**ctx
);
800 int lttng_add_procname_to_ctx(struct lttng_ctx
**ctx
);
801 int lttng_add_ip_to_ctx(struct lttng_ctx
**ctx
);
802 int lttng_add_cpu_id_to_ctx(struct lttng_ctx
**ctx
);
803 int lttng_add_dyntest_to_ctx(struct lttng_ctx
**ctx
);
804 int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx
**ctx
);
805 int lttng_add_ipc_ns_to_ctx(struct lttng_ctx
**ctx
);
806 int lttng_add_mnt_ns_to_ctx(struct lttng_ctx
**ctx
);
807 int lttng_add_net_ns_to_ctx(struct lttng_ctx
**ctx
);
808 int lttng_add_pid_ns_to_ctx(struct lttng_ctx
**ctx
);
809 int lttng_add_time_ns_to_ctx(struct lttng_ctx
**ctx
);
810 int lttng_add_user_ns_to_ctx(struct lttng_ctx
**ctx
);
811 int lttng_add_uts_ns_to_ctx(struct lttng_ctx
**ctx
);
812 int lttng_add_vuid_to_ctx(struct lttng_ctx
**ctx
);
813 int lttng_add_veuid_to_ctx(struct lttng_ctx
**ctx
);
814 int lttng_add_vsuid_to_ctx(struct lttng_ctx
**ctx
);
815 int lttng_add_vgid_to_ctx(struct lttng_ctx
**ctx
);
816 int lttng_add_vegid_to_ctx(struct lttng_ctx
**ctx
);
817 int lttng_add_vsgid_to_ctx(struct lttng_ctx
**ctx
);
818 void lttng_context_vtid_reset(void);
819 void lttng_context_vpid_reset(void);
820 void lttng_context_procname_reset(void);
821 void lttng_context_cgroup_ns_reset(void);
822 void lttng_context_ipc_ns_reset(void);
823 void lttng_context_mnt_ns_reset(void);
824 void lttng_context_net_ns_reset(void);
825 void lttng_context_pid_ns_reset(void);
826 void lttng_context_time_ns_reset(void);
827 void lttng_context_user_ns_reset(void);
828 void lttng_context_uts_ns_reset(void);
829 void lttng_context_vuid_reset(void);
830 void lttng_context_veuid_reset(void);
831 void lttng_context_vsuid_reset(void);
832 void lttng_context_vgid_reset(void);
833 void lttng_context_vegid_reset(void);
834 void lttng_context_vsgid_reset(void);
836 #ifdef LTTNG_UST_HAVE_PERF_EVENT
837 int lttng_add_perf_counter_to_ctx(uint32_t type
,
840 struct lttng_ctx
**ctx
);
841 int lttng_perf_counter_init(void);
842 void lttng_perf_counter_exit(void);
843 #else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */
845 int lttng_add_perf_counter_to_ctx(uint32_t type
,
848 struct lttng_ctx
**ctx
)
853 int lttng_perf_counter_init(void)
858 void lttng_perf_counter_exit(void)
861 #endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */
863 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_metadata
;
864 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_discard
;
865 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_overwrite
;
867 struct lttng_transport
*lttng_transport_find(const char *name
);
868 struct lttng_counter_transport
*lttng_counter_transport_find(const char *name
);
870 int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list
*list
);
871 void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list
*list
);
872 struct lttng_ust_tracepoint_iter
*
873 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list
*list
);
874 int lttng_probes_get_field_list(struct lttng_ust_field_list
*list
);
875 void lttng_probes_prune_field_list(struct lttng_ust_field_list
*list
);
876 struct lttng_ust_field_iter
*
877 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list
*list
);
879 void lttng_free_event_filter_runtime(struct lttng_event
*event
);
881 struct cds_list_head
*lttng_get_probe_list_head(void);
882 int lttng_session_active(void);
884 typedef int (*t_statedump_func_ptr
)(struct lttng_session
*session
);
885 void lttng_handle_pending_statedump(void *owner
);
886 struct cds_list_head
*_lttng_get_sessions(void);
888 struct lttng_enum
*lttng_ust_enum_get_from_desc(struct lttng_session
*session
,
889 const struct lttng_enum_desc
*enum_desc
);
891 void lttng_ust_dl_update(void *ip
);
892 void lttng_ust_fixup_fd_tracker_tls(void);
894 /* For backward compatibility. Leave those exported symbols in place. */
895 extern struct lttng_ctx
*lttng_static_ctx
;
896 struct lttng_ust_filter_bytecode_node
;
897 struct lttng_ust_excluder_node
;
898 void lttng_context_init(void);
899 void lttng_context_exit(void);
900 void lttng_filter_event_link_bytecode(struct lttng_event
*event
);
901 struct lttng_enabler
*lttng_enabler_create(
902 enum lttng_enabler_format_type format_type
,
903 struct lttng_ust_event
*event_param
,
904 struct lttng_channel
*chan
);
905 int lttng_enabler_enable(struct lttng_enabler
*enabler
);
906 int lttng_enabler_disable(struct lttng_enabler
*enabler
);
907 int lttng_enabler_attach_bytecode(struct lttng_enabler
*enabler
,
908 struct lttng_ust_filter_bytecode_node
*bytecode
);
909 int lttng_enabler_attach_context(struct lttng_enabler
*enabler
,
910 struct lttng_ust_context
*ctx
);
911 int lttng_enabler_attach_exclusion(struct lttng_enabler
*enabler
,
912 struct lttng_ust_excluder_node
*excluder
);
913 void lttng_enabler_event_link_bytecode(struct lttng_event
*event
,
914 struct lttng_enabler
*enabler
);
915 void lttng_filter_sync_state(struct lttng_bytecode_runtime
*runtime
);
916 int lttng_session_context_init(struct lttng_ctx
**ctx
);
923 #endif /* _LTTNG_UST_EVENTS_H */