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