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