ust cyg-profile: use same class for entry and exit
[lttng-ust.git] / include / lttng / ust-events.h
CommitLineData
51489cad
MD
1#ifndef _LTTNG_UST_EVENTS_H
2#define _LTTNG_UST_EVENTS_H
8020ceb5
MD
3
4/*
51489cad 5 * lttng/ust-events.h
8020ceb5 6 *
e92f3e28 7 * Copyright 2010-2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8020ceb5
MD
8 *
9 * Holds LTTng per-session event registry.
10 *
e92f3e28
MD
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:
a60d70e6 17 *
e92f3e28
MD
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
d2428e87
MD
20 *
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
27 * SOFTWARE.
8020ceb5
MD
28 */
29
9f3fdbc6 30#include <urcu/list.h>
1f18504e 31#include <urcu/hlist.h>
9f3fdbc6 32#include <stdint.h>
d58d1454 33#include <lttng/ust-config.h>
4318ae1b
MD
34#include <lttng/ust-abi.h>
35#include <lttng/ust-tracer.h>
2ae57758 36#include <lttng/ust-endian.h>
20f1eee7 37#include <float.h>
d58d1454
MD
38#include <errno.h>
39#include <urcu/ref.h>
40#include <pthread.h>
8020ceb5 41
6453d237
MD
42#ifdef __cplusplus
43extern "C" {
44#endif
45
19d8b1b3
MD
46#define LTTNG_UST_UUID_LEN 16
47
71d31690
MD
48/*
49 * Tracepoint provider version. Compatibility based on the major number.
50 * Older tracepoint providers can always register to newer lttng-ust
51 * library, but the opposite is rejected: a newer tracepoint provider is
52 * rejected by an older lttng-ust library.
53 */
54#define LTTNG_UST_PROVIDER_MAJOR 1
55#define LTTNG_UST_PROVIDER_MINOR 0
56
7dd08bec
MD
57struct lttng_channel;
58struct lttng_session;
4cfec15c 59struct lttng_ust_lib_ring_buffer_ctx;
8020ceb5 60
37d5e202
MD
61/*
62 * Data structures used by tracepoint event declarations, and by the
63 * tracer. Those structures have padding for future extension.
64 */
65
c1fca457
MD
66/*
67 * LTTng client type enumeration. Used by the consumer to map the
68 * callbacks from its own address space.
69 */
70enum lttng_client_types {
71 LTTNG_CLIENT_METADATA = 0,
72 LTTNG_CLIENT_DISCARD = 1,
73 LTTNG_CLIENT_OVERWRITE = 2,
34a91bdb
MD
74 LTTNG_CLIENT_DISCARD_RT = 3,
75 LTTNG_CLIENT_OVERWRITE_RT = 4,
c1fca457
MD
76 LTTNG_NR_CLIENT_TYPES,
77};
78
8020ceb5
MD
79/* Type description */
80
81/* Update the astract_types name table in lttng-types.c along with this enum */
7dd08bec 82enum lttng_abstract_types {
8020ceb5
MD
83 atype_integer,
84 atype_enum,
85 atype_array,
86 atype_sequence,
87 atype_string,
20f1eee7 88 atype_float,
8020ceb5
MD
89 NR_ABSTRACT_TYPES,
90};
91
92/* Update the string_encodings name table in lttng-types.c along with this enum */
93enum lttng_string_encodings {
94 lttng_encode_none = 0,
95 lttng_encode_UTF8 = 1,
96 lttng_encode_ASCII = 2,
97 NR_STRING_ENCODINGS,
98};
99
37d5e202 100#define LTTNG_UST_ENUM_ENTRY_PADDING 16
8020ceb5
MD
101struct lttng_enum_entry {
102 unsigned long long start, end; /* start and end are inclusive */
103 const char *string;
37d5e202 104 char padding[LTTNG_UST_ENUM_ENTRY_PADDING];
8020ceb5
MD
105};
106
107#define __type_integer(_type, _byte_order, _base, _encoding) \
108 { \
46d52200
ZT
109 .atype = atype_integer, \
110 .u = \
8020ceb5 111 { \
46d52200
ZT
112 .basic = \
113 { \
114 .integer = \
115 { \
116 .size = sizeof(_type) * CHAR_BIT, \
117 .alignment = lttng_alignof(_type) * CHAR_BIT, \
118 .signedness = lttng_is_signed_type(_type), \
119 .reverse_byte_order = _byte_order != BYTE_ORDER, \
120 .base = _base, \
121 .encoding = lttng_encode_##_encoding, \
122 } \
123 } \
8020ceb5
MD
124 }, \
125 } \
126
37d5e202 127#define LTTNG_UST_INTEGER_TYPE_PADDING 24
8020ceb5
MD
128struct lttng_integer_type {
129 unsigned int size; /* in bits */
130 unsigned short alignment; /* in bits */
131 unsigned int signedness:1;
132 unsigned int reverse_byte_order:1;
133 unsigned int base; /* 2, 8, 10, 16, for pretty print */
134 enum lttng_string_encodings encoding;
37d5e202 135 char padding[LTTNG_UST_INTEGER_TYPE_PADDING];
8020ceb5
MD
136};
137
d3ed854b
MD
138/*
139 * Only float and double are supported. long double is not supported at
140 * the moment.
141 */
20f1eee7
MD
142#define _float_mant_dig(_type) \
143 (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \
144 : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \
d3ed854b 145 : 0))
20f1eee7
MD
146
147#define __type_float(_type) \
148 { \
46d52200
ZT
149 .atype = atype_float, \
150 .u = \
20f1eee7 151 { \
46d52200
ZT
152 .basic = \
153 { \
154 ._float = \
155 { \
156 .exp_dig = sizeof(_type) * CHAR_BIT \
157 - _float_mant_dig(_type), \
158 .mant_dig = _float_mant_dig(_type), \
159 .alignment = lttng_alignof(_type) * CHAR_BIT, \
160 .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
161 } \
162 } \
20f1eee7
MD
163 }, \
164 } \
165
37d5e202 166#define LTTNG_UST_FLOAT_TYPE_PADDING 24
20f1eee7
MD
167struct lttng_float_type {
168 unsigned int exp_dig; /* exponent digits, in bits */
169 unsigned int mant_dig; /* mantissa digits, in bits */
170 unsigned short alignment; /* in bits */
171 unsigned int reverse_byte_order:1;
37d5e202 172 char padding[LTTNG_UST_FLOAT_TYPE_PADDING];
20f1eee7
MD
173};
174
37d5e202 175#define LTTNG_UST_BASIC_TYPE_PADDING 128
8020ceb5
MD
176union _lttng_basic_type {
177 struct lttng_integer_type integer;
178 struct {
179 const char *name;
180 } enumeration;
181 struct {
182 enum lttng_string_encodings encoding;
183 } string;
20f1eee7 184 struct lttng_float_type _float;
37d5e202 185 char padding[LTTNG_UST_BASIC_TYPE_PADDING];
8020ceb5
MD
186};
187
188struct lttng_basic_type {
7dd08bec 189 enum lttng_abstract_types atype;
8020ceb5
MD
190 union {
191 union _lttng_basic_type basic;
192 } u;
193};
194
37d5e202 195#define LTTNG_UST_TYPE_PADDING 128
8020ceb5 196struct lttng_type {
7dd08bec 197 enum lttng_abstract_types atype;
8020ceb5
MD
198 union {
199 union _lttng_basic_type basic;
200 struct {
201 struct lttng_basic_type elem_type;
202 unsigned int length; /* num. elems. */
203 } array;
204 struct {
205 struct lttng_basic_type length_type;
206 struct lttng_basic_type elem_type;
207 } sequence;
37d5e202 208 char padding[LTTNG_UST_TYPE_PADDING];
8020ceb5
MD
209 } u;
210};
211
37d5e202 212#define LTTNG_UST_ENUM_TYPE_PADDING 24
8020ceb5
MD
213struct lttng_enum {
214 const char *name;
215 struct lttng_type container_type;
216 const struct lttng_enum_entry *entries;
23c8854a 217 unsigned int len;
37d5e202 218 char padding[LTTNG_UST_ENUM_TYPE_PADDING];
8020ceb5
MD
219};
220
180901e6
MD
221/*
222 * Event field description
223 *
224 * IMPORTANT: this structure is part of the ABI between the probe and
225 * UST. Fields need to be only added at the end, never reordered, never
226 * removed.
227 */
8020ceb5 228
4774c8f3 229#define LTTNG_UST_EVENT_FIELD_PADDING 28
8020ceb5
MD
230struct lttng_event_field {
231 const char *name;
232 struct lttng_type type;
180901e6 233 unsigned int nowrite; /* do not write into trace */
37d5e202 234 char padding[LTTNG_UST_EVENT_FIELD_PADDING];
8020ceb5
MD
235};
236
77aa5901
MD
237union lttng_ctx_value {
238 int64_t s64;
239 const char *str;
240 double d;
241};
242
d58d1454
MD
243struct lttng_perf_counter_field;
244
37d5e202 245#define LTTNG_UST_CTX_FIELD_PADDING 40
8020ceb5
MD
246struct lttng_ctx_field {
247 struct lttng_event_field event_field;
248 size_t (*get_size)(size_t offset);
249 void (*record)(struct lttng_ctx_field *field,
4cfec15c 250 struct lttng_ust_lib_ring_buffer_ctx *ctx,
7dd08bec 251 struct lttng_channel *chan);
77aa5901
MD
252 void (*get_value)(struct lttng_ctx_field *field,
253 union lttng_ctx_value *value);
8020ceb5 254 union {
d58d1454 255 struct lttng_perf_counter_field *perf_counter;
37d5e202 256 char padding[LTTNG_UST_CTX_FIELD_PADDING];
8020ceb5
MD
257 } u;
258 void (*destroy)(struct lttng_ctx_field *field);
259};
260
b2cc986a 261#define LTTNG_UST_CTX_PADDING 20
8020ceb5
MD
262struct lttng_ctx {
263 struct lttng_ctx_field *fields;
264 unsigned int nr_fields;
265 unsigned int allocated_fields;
b2cc986a 266 unsigned int largest_align;
37d5e202
MD
267 char padding[LTTNG_UST_CTX_PADDING];
268};
269
270#define LTTNG_UST_EVENT_DESC_PADDING 40
271struct lttng_event_desc {
272 const char *name;
fbdeb5ec 273 void (*probe_callback)(void);
37d5e202
MD
274 const struct lttng_event_ctx *ctx; /* context */
275 const struct lttng_event_field *fields; /* event payload */
276 unsigned int nr_fields;
277 const int **loglevel;
68755429 278 const char *signature; /* Argument types/names received */
6ddc916d
MD
279 union {
280 struct {
281 const char **model_emf_uri;
282 } ext;
283 char padding[LTTNG_UST_EVENT_DESC_PADDING];
284 } u;
37d5e202
MD
285};
286
71d31690 287#define LTTNG_UST_PROBE_DESC_PADDING 12
37d5e202
MD
288struct lttng_probe_desc {
289 const char *provider;
290 const struct lttng_event_desc **event_desc;
291 unsigned int nr_events;
292 struct cds_list_head head; /* chain registered probes */
6715d7d1
MD
293 struct cds_list_head lazy_init_head;
294 int lazy; /* lazy registration */
71d31690
MD
295 uint32_t major;
296 uint32_t minor;
37d5e202 297 char padding[LTTNG_UST_PROBE_DESC_PADDING];
8020ceb5
MD
298};
299
37d5e202
MD
300/* Data structures used by the tracer. */
301
e58095ef
MD
302enum lttng_enabler_type {
303 LTTNG_ENABLER_WILDCARD,
304 LTTNG_ENABLER_EVENT,
e6c12e3d
MD
305};
306
307/*
e58095ef
MD
308 * Enabler field, within whatever object is enabling an event. Target of
309 * backward reference.
e6c12e3d 310 */
e58095ef
MD
311struct lttng_enabler {
312 enum lttng_enabler_type type;
313
314 /* head list of struct lttng_ust_filter_bytecode_node */
315 struct cds_list_head filter_bytecode_head;
0f63324a
JI
316 /* head list of struct lttng_ust_excluder_node */
317 struct cds_list_head excluder_head;
e58095ef
MD
318 struct cds_list_head node; /* per-session list of enablers */
319
320 struct lttng_ust_event event_param;
321 struct lttng_channel *chan;
322 struct lttng_ctx *ctx;
323 unsigned int enabled:1;
e6c12e3d
MD
324};
325
c8fcf224
MD
326struct tp_list_entry {
327 struct lttng_ust_tracepoint_iter tp;
328 struct cds_list_head head;
329};
330
331struct lttng_ust_tracepoint_list {
332 struct tp_list_entry *iter;
333 struct cds_list_head head;
8020ceb5
MD
334};
335
06d4f27e
MD
336struct tp_field_list_entry {
337 struct lttng_ust_field_iter field;
338 struct cds_list_head head;
339};
340
341struct lttng_ust_field_list {
342 struct tp_field_list_entry *iter;
343 struct cds_list_head head;
344};
345
8165c8da 346struct ust_pending_probe;
7dd08bec 347struct lttng_event;
f488575f
MD
348
349struct lttng_ust_filter_bytecode_node {
350 struct cds_list_head node;
e58095ef 351 struct lttng_enabler *enabler;
a543151c
MD
352 /*
353 * struct lttng_ust_filter_bytecode has var. sized array, must
354 * be last field.
355 */
356 struct lttng_ust_filter_bytecode bc;
f488575f
MD
357};
358
0f63324a
JI
359struct lttng_ust_excluder_node {
360 struct cds_list_head node;
361 struct lttng_enabler *enabler;
362 /*
363 * struct lttng_ust_event_exclusion had variable sized array,
364 * must be last field.
365 */
366 struct lttng_ust_event_exclusion excluder;
367};
8a92ed2a
MD
368/*
369 * Filter return value masks.
370 */
371enum lttng_filter_ret {
372 LTTNG_FILTER_DISCARD = 0,
373 LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
374 /* Other bits are kept for future use. */
375};
376
f488575f
MD
377struct lttng_bytecode_runtime {
378 /* Associated bytecode */
379 struct lttng_ust_filter_bytecode_node *bc;
8a92ed2a 380 uint64_t (*filter)(void *filter_data, const char *filter_stack_data);
21af05a9 381 int link_failed;
e58095ef
MD
382 struct cds_list_head node; /* list of bytecode runtime in event */
383};
384
385/*
386 * Objects in a linked-list of enablers, owned by an event.
387 */
388struct lttng_enabler_ref {
389 struct cds_list_head node; /* enabler ref list */
390 struct lttng_enabler *ref; /* backward ref */
f488575f 391};
8165c8da 392
8020ceb5 393/*
7dd08bec
MD
394 * lttng_event structure is referred to by the tracing fast path. It
395 * must be kept small.
180901e6
MD
396 *
397 * IMPORTANT: this structure is part of the ABI between the probe and
398 * UST. Fields need to be only added at the end, never reordered, never
399 * removed.
8020ceb5 400 */
7dd08bec 401struct lttng_event {
180901e6 402 /* LTTng-UST 2.0 starts here */
8020ceb5 403 unsigned int id;
7dd08bec 404 struct lttng_channel *chan;
976fe9ea 405 int enabled;
8020ceb5 406 const struct lttng_event_desc *desc;
e58095ef 407 void *_deprecated1;
8020ceb5 408 struct lttng_ctx *ctx;
9f3fdbc6 409 enum lttng_ust_instrumentation instrumentation;
e58095ef
MD
410 struct cds_list_head node; /* Event list in session */
411 struct cds_list_head _deprecated2;
412 void *_deprecated3;
13b21cd6 413 unsigned int _deprecated4:1;
e58095ef 414
180901e6 415 /* LTTng-UST 2.1 starts here */
e58095ef
MD
416 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
417 struct cds_list_head bytecode_runtime_head;
dcdeaff0 418 int has_enablers_without_bytecode;
e58095ef
MD
419 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
420 struct cds_list_head enablers_ref_head;
d56fa719 421 struct cds_hlist_node hlist; /* session ht of events */
ac6b4ac6 422 int registered; /* has reg'd tracepoint probe */
8020ceb5
MD
423};
424
8d8a24c8 425struct channel;
38fae1d3 426struct lttng_ust_shm_handle;
8d8a24c8 427
180901e6
MD
428/*
429 * IMPORTANT: this structure is part of the ABI between the probe and
430 * UST. Fields need to be only added at the end, never reordered, never
431 * removed.
432 */
7dd08bec
MD
433struct lttng_channel_ops {
434 struct lttng_channel *(*channel_create)(const char *name,
74d81a6c
MD
435 void *buf_addr,
436 size_t subbuf_size, size_t num_subbuf,
437 unsigned int switch_timer_interval,
438 unsigned int read_timer_interval,
6ca18e66 439 unsigned char *uuid,
a9ff648c 440 uint32_t chan_id,
5ea386c3 441 const int *stream_fds, int nr_stream_fds);
74d81a6c 442 void (*channel_destroy)(struct lttng_channel *chan);
a44c74d9
MD
443 union {
444 void *_deprecated1;
445 unsigned long has_strcpy:1; /* ABI has strcpy */
446 } u;
9e917229 447 void *_deprecated2;
4cfec15c 448 int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
8020ceb5 449 uint32_t event_id);
4cfec15c 450 void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx);
74d81a6c
MD
451 void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
452 const void *src, size_t len);
8020ceb5
MD
453 /*
454 * packet_avail_size returns the available size in the current
455 * packet. Note that the size returned is only a hint, since it
456 * may change due to concurrent writes.
457 */
1d498196 458 size_t (*packet_avail_size)(struct channel *chan,
38fae1d3 459 struct lttng_ust_shm_handle *handle);
9f3fdbc6
MD
460 //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
461 //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
8020ceb5
MD
462 int (*is_finalized)(struct channel *chan);
463 int (*is_disabled)(struct channel *chan);
38fae1d3 464 int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle);
a44c74d9
MD
465 void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
466 const char *src, size_t len);
8020ceb5
MD
467};
468
180901e6
MD
469/*
470 * IMPORTANT: this structure is part of the ABI between the probe and
471 * UST. Fields need to be only added at the end, never reordered, never
472 * removed.
473 */
7dd08bec 474struct lttng_channel {
a3f61e7f
MD
475 /*
476 * The pointers located in this private data are NOT safe to be
477 * dereferenced by the consumer. The only operations the
478 * consumer process is designed to be allowed to do is to read
479 * and perform subbuffer flush.
480 */
8020ceb5 481 struct channel *chan; /* Channel buffers */
976fe9ea 482 int enabled;
8020ceb5
MD
483 struct lttng_ctx *ctx;
484 /* Event ID management */
7dd08bec 485 struct lttng_session *session;
0a42beb6 486 int objd; /* Object associated to channel */
32ce8569
MD
487 unsigned int _deprecated1;
488 unsigned int _deprecated2;
e58095ef 489 struct cds_list_head node; /* Channel list in session */
74d81a6c 490 const struct lttng_channel_ops *ops;
8020ceb5 491 int header_type; /* 0: unset, 1: compact, 2: large */
38fae1d3 492 struct lttng_ust_shm_handle *handle; /* shared-memory handle */
13b21cd6 493 unsigned int _deprecated3:1;
a3f61e7f 494
74d81a6c 495 /* Channel ID */
a3f61e7f 496 unsigned int id;
74d81a6c 497 enum lttng_ust_chan_type type;
19d8b1b3 498 unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
ac6b4ac6 499 int tstate:1; /* Transient enable state */
8020ceb5
MD
500};
501
71a9d034 502#define LTTNG_UST_EVENT_HT_BITS 12
e58095ef
MD
503#define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
504
505struct lttng_ust_event_ht {
506 struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
507};
508
180901e6
MD
509/*
510 * IMPORTANT: this structure is part of the ABI between the probe and
511 * UST. Fields need to be only added at the end, never reordered, never
512 * removed.
513 */
7dd08bec 514struct lttng_session {
e58095ef
MD
515 int active; /* Is trace session active ? */
516 int been_active; /* Been active ? */
517 int objd; /* Object associated */
13b21cd6 518 void *_deprecated1;
e58095ef
MD
519 struct cds_list_head chan_head; /* Channel list head */
520 struct cds_list_head events_head; /* list of events */
13b21cd6 521 struct cds_list_head _deprecated2;
e58095ef 522 struct cds_list_head node; /* Session list */
13b21cd6
MD
523 int _deprecated3;
524 unsigned int _deprecated4:1;
e58095ef
MD
525
526 /* New UST 2.1 */
527 /* List of enablers */
528 struct cds_list_head enablers_head;
d56fa719 529 struct lttng_ust_event_ht events_ht; /* ht of events */
32ce8569 530 void *owner; /* object owner */
ac6b4ac6 531 int tstate:1; /* Transient enable state */
246be17e
PW
532
533 /* New UST 2.4 */
534 int statedump_pending:1;
8020ceb5
MD
535};
536
7dd08bec 537struct lttng_transport {
8020ceb5 538 char *name;
9f3fdbc6 539 struct cds_list_head node;
7dd08bec 540 struct lttng_channel_ops ops;
74d81a6c 541 const struct lttng_ust_lib_ring_buffer_config *client_config;
8020ceb5
MD
542};
543
7dd08bec
MD
544struct lttng_session *lttng_session_create(void);
545int lttng_session_enable(struct lttng_session *session);
546int lttng_session_disable(struct lttng_session *session);
547void lttng_session_destroy(struct lttng_session *session);
8020ceb5 548
7dd08bec 549struct lttng_channel *lttng_channel_create(struct lttng_session *session,
8020ceb5
MD
550 const char *transport_name,
551 void *buf_addr,
552 size_t subbuf_size, size_t num_subbuf,
553 unsigned int switch_timer_interval,
193183fb 554 unsigned int read_timer_interval,
ef9ff354
MD
555 int **shm_fd, int **wait_fd,
556 uint64_t **memory_map_size,
7dd08bec 557 struct lttng_channel *chan_priv_init);
8020ceb5 558
7dd08bec
MD
559int lttng_channel_enable(struct lttng_channel *channel);
560int lttng_channel_disable(struct lttng_channel *channel);
e58095ef
MD
561
562struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
563 struct lttng_ust_event *event_param,
564 struct lttng_channel *chan);
565int lttng_enabler_enable(struct lttng_enabler *enabler);
566int lttng_enabler_disable(struct lttng_enabler *enabler);
567int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
568 struct lttng_ust_filter_bytecode_node *bytecode);
569int lttng_enabler_attach_context(struct lttng_enabler *enabler,
570 struct lttng_ust_context *ctx);
0bfb5cbd
JI
571int lttng_enabler_attach_exclusion(struct lttng_enabler *enabler,
572 struct lttng_ust_excluder_node *excluder);
e58095ef
MD
573
574int lttng_attach_context(struct lttng_ust_context *context_param,
575 struct lttng_ctx **ctx, struct lttng_session *session);
a0a3bef9
MD
576void lttng_context_init(void);
577void lttng_context_exit(void);
0478bb8c 578extern struct lttng_ctx *lttng_static_ctx; /* Used by filtering */
976fe9ea 579
7dd08bec
MD
580void lttng_transport_register(struct lttng_transport *transport);
581void lttng_transport_unregister(struct lttng_transport *transport);
8020ceb5 582
4b4de73e 583void synchronize_trace(void);
8020ceb5 584
7dd08bec
MD
585int lttng_probe_register(struct lttng_probe_desc *desc);
586void lttng_probe_unregister(struct lttng_probe_desc *desc);
5f733922 587int lttng_fix_pending_events(void);
7dd08bec
MD
588int lttng_probes_init(void);
589void lttng_probes_exit(void);
8173ec7c 590int lttng_find_context(struct lttng_ctx *ctx, const char *name);
77aa5901 591int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
8173ec7c 592struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p);
b2cc986a 593void lttng_context_update(struct lttng_ctx *ctx);
8173ec7c 594void lttng_remove_context_field(struct lttng_ctx **ctx_p,
8020ceb5
MD
595 struct lttng_ctx_field *field);
596void lttng_destroy_context(struct lttng_ctx *ctx);
3b402b40 597int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
c1ef86f0 598int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
8173ec7c 599int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx);
4847e9bb 600int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
96f85541 601int lttng_add_ip_to_ctx(struct lttng_ctx **ctx);
a93bfc45 602void lttng_context_vtid_reset(void);
c1ef86f0 603void lttng_context_vpid_reset(void);
9f3fdbc6 604
d58d1454
MD
605#ifdef LTTNG_UST_HAVE_PERF_EVENT
606int lttng_add_perf_counter_to_ctx(uint32_t type,
607 uint64_t config,
608 const char *name,
609 struct lttng_ctx **ctx);
610int lttng_perf_counter_init(void);
611void lttng_perf_counter_exit(void);
612#else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */
613static inline
614int lttng_add_perf_counter_to_ctx(uint32_t type,
615 uint64_t config,
616 const char *name,
617 struct lttng_ctx **ctx)
618{
619 return -ENOSYS;
620}
621static inline
622int lttng_perf_counter_init(void)
623{
624 return 0;
625}
626static inline
627void lttng_perf_counter_exit(void)
628{
629}
630#endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */
631
82b9bde8
JD
632extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_metadata;
633extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_discard;
634extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_overwrite;
c1fca457 635
7dd08bec 636struct lttng_transport *lttng_transport_find(const char *name);
c1fca457 637
7dd08bec
MD
638int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list);
639void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list);
c8fcf224
MD
640struct lttng_ust_tracepoint_iter *
641 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list);
7dd08bec
MD
642int lttng_probes_get_field_list(struct lttng_ust_field_list *list);
643void lttng_probes_prune_field_list(struct lttng_ust_field_list *list);
06d4f27e
MD
644struct lttng_ust_field_iter *
645 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list);
c8fcf224 646
7dd08bec 647void lttng_filter_event_link_bytecode(struct lttng_event *event);
e58095ef
MD
648void lttng_enabler_event_link_bytecode(struct lttng_event *event,
649 struct lttng_enabler *enabler);
7dd08bec 650void lttng_free_event_filter_runtime(struct lttng_event *event);
e58095ef
MD
651void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
652
653struct cds_list_head *lttng_get_probe_list_head(void);
6715d7d1 654int lttng_session_active(void);
e6c12e3d 655
246be17e 656typedef int (*t_statedump_func_ptr)(struct lttng_session *session);
3327ac33 657void lttng_handle_pending_statedump(void *owner);
37dddb65 658struct cds_list_head *_lttng_get_sessions(void);
246be17e 659
6453d237
MD
660#ifdef __cplusplus
661}
662#endif
663
51489cad 664#endif /* _LTTNG_UST_EVENTS_H */
This page took 0.084209 seconds and 4 git commands to generate.