201
201
size_t (*get_size)(size_t offset);
202
202
void (*record)(struct lttng_ctx_field *field,
203
203
struct lttng_ust_lib_ring_buffer_ctx *ctx,
204
struct ltt_channel *chan);
204
struct lttng_channel *chan);
206
206
char padding[LTTNG_UST_CTX_FIELD_PADDING];
240
245
/* Data structures used by the tracer. */
247
enum lttng_enabler_type {
248
LTTNG_ENABLER_WILDCARD,
243
* Entry describing a per-session active wildcard, along with the event
244
* attribute and channel information configuring the events that need to
253
* Enabler field, within whatever object is enabling an event. Target of
254
* backward reference.
247
struct session_wildcard {
248
struct ltt_channel *chan;
249
struct lttng_ctx *ctx; /* TODO */
256
struct lttng_enabler {
257
enum lttng_enabler_type type;
259
/* head list of struct lttng_ust_filter_bytecode_node */
260
struct cds_list_head filter_bytecode_head;
261
struct cds_list_head node; /* per-session list of enablers */
250
263
struct lttng_ust_event event_param;
251
struct cds_list_head events; /* list of events enabled */
252
struct cds_list_head list; /* per-session list of wildcards */
253
struct cds_list_head session_list; /* node of session wildcard list */
254
struct wildcard_entry *entry;
255
struct lttng_ust_filter_bytecode *filter_bytecode;
264
struct lttng_channel *chan;
265
struct lttng_ctx *ctx;
256
266
unsigned int enabled:1;
260
* Entry describing an active wildcard (per name) for all sessions.
262
struct wildcard_entry {
263
/* node of global wildcards list */
264
struct cds_list_head list;
265
/* head of session list to which this wildcard apply */
266
struct cds_list_head session_list;
267
enum lttng_ust_loglevel_type loglevel_type;
268
struct lttng_ust_filter_bytecode *filter_bytecode;
273
269
struct tp_list_entry {
274
270
struct lttng_ust_tracepoint_iter tp;
275
271
struct cds_list_head head;
293
289
struct ust_pending_probe;
295
struct lttng_ust_filter_bytecode;
298
* ltt_event structure is referred to by the tracing fast path. It must be
292
struct lttng_ust_filter_bytecode_node {
293
struct cds_list_head node;
294
struct lttng_enabler *enabler;
296
* struct lttng_ust_filter_bytecode has var. sized array, must
299
struct lttng_ust_filter_bytecode bc;
303
* Filter return value masks.
305
enum lttng_filter_ret {
306
LTTNG_FILTER_DISCARD = 0,
307
LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
308
/* Other bits are kept for future use. */
311
struct lttng_bytecode_runtime {
312
/* Associated bytecode */
313
struct lttng_ust_filter_bytecode_node *bc;
314
uint64_t (*filter)(void *filter_data, const char *filter_stack_data);
316
struct cds_list_head node; /* list of bytecode runtime in event */
320
* Objects in a linked-list of enablers, owned by an event.
322
struct lttng_enabler_ref {
323
struct cds_list_head node; /* enabler ref list */
324
struct lttng_enabler *ref; /* backward ref */
328
* lttng_event structure is referred to by the tracing fast path. It
329
* must be kept small.
301
331
* IMPORTANT: this structure is part of the ABI between the probe and
302
332
* UST. Fields need to be only added at the end, never reordered, never
306
336
/* LTTng-UST 2.0 starts here */
308
struct ltt_channel *chan;
338
struct lttng_channel *chan;
310
340
const struct lttng_event_desc *desc;
311
int (*filter)(void *filter_data, const char *filter_stack_data);
312
342
struct lttng_ctx *ctx;
313
343
enum lttng_ust_instrumentation instrumentation;
316
struct cds_list_head list; /* Event list */
317
struct cds_list_head wildcard_list; /* Event list for wildcard */
318
struct ust_pending_probe *pending_probe;
346
struct cds_list_head node; /* Event list in session */
347
struct cds_list_head _deprecated2;
319
349
unsigned int metadata_dumped:1;
320
351
/* LTTng-UST 2.1 starts here */
321
struct lttng_ust_filter_bytecode *filter_bytecode;
352
/* list of struct lttng_bytecode_runtime, sorted by seqnum */
353
struct cds_list_head bytecode_runtime_head;
355
/* Backward references: list of lttng_enabler_ref (ref to enablers) */
356
struct cds_list_head enablers_ref_head;
330
364
* UST. Fields need to be only added at the end, never reordered, never
333
struct ltt_channel_ops {
334
struct ltt_channel *(*channel_create)(const char *name,
367
struct lttng_channel_ops {
368
struct lttng_channel *(*channel_create)(const char *name,
336
370
size_t subbuf_size, size_t num_subbuf,
337
371
unsigned int switch_timer_interval,
338
372
unsigned int read_timer_interval,
339
373
int **shm_fd, int **wait_fd,
340
374
uint64_t **memory_map_size,
341
struct ltt_channel *chan_priv_init);
342
void (*channel_destroy)(struct ltt_channel *ltt_chan);
375
struct lttng_channel *chan_priv_init);
376
void (*channel_destroy)(struct lttng_channel *lttng_chan);
343
377
struct lttng_ust_lib_ring_buffer *(*buffer_read_open)(struct channel *chan,
344
378
struct lttng_ust_shm_handle *handle,
345
379
int **shm_fd, int **wait_fd,
382
416
struct lttng_ctx *ctx;
383
417
/* Event ID management */
384
struct ltt_session *session;
418
struct lttng_session *session;
385
419
int objd; /* Object associated to channel */
386
420
unsigned int free_event_id; /* Next event ID to allocate */
387
421
unsigned int used_event_id; /* Max allocated event IDs */
388
struct cds_list_head list; /* Channel list */
389
struct ltt_channel_ops *ops;
422
struct cds_list_head node; /* Channel list in session */
423
struct lttng_channel_ops *ops;
390
424
int header_type; /* 0: unset, 1: compact, 2: large */
391
425
struct lttng_ust_shm_handle *handle; /* shared-memory handle */
392
426
unsigned int metadata_dumped:1;
397
431
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
434
#define LTTNG_UST_EVENT_HT_BITS 6
435
#define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
437
struct lttng_ust_event_ht {
438
struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
401
442
* IMPORTANT: this structure is part of the ABI between the probe and
402
443
* UST. Fields need to be only added at the end, never reordered, never
406
int active; /* Is trace session active ? */
407
int been_active; /* Has trace session been active ? */
408
int objd; /* Object associated to session */
409
struct ltt_channel *metadata; /* Metadata channel */
410
struct cds_list_head chan; /* Channel list head */
411
struct cds_list_head events; /* Event list head */
412
struct cds_list_head wildcards; /* Wildcard list head */
413
struct cds_list_head list; /* Session list */
414
unsigned int free_chan_id; /* Next chan ID to allocate */
446
struct lttng_session {
447
int active; /* Is trace session active ? */
448
int been_active; /* Been active ? */
449
int objd; /* Object associated */
450
struct lttng_channel *metadata; /* Metadata channel */
451
struct cds_list_head chan_head; /* Channel list head */
452
struct cds_list_head events_head; /* list of events */
453
struct cds_list_head _deprecated1;
454
struct cds_list_head node; /* Session list */
455
unsigned int free_chan_id; /* Next chan ID to allocate */
415
456
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
416
457
unsigned int metadata_dumped:1;
460
/* List of enablers */
461
struct cds_list_head enablers_head;
419
struct ltt_transport {
464
struct lttng_transport {
421
466
struct cds_list_head node;
422
struct ltt_channel_ops ops;
467
struct lttng_channel_ops ops;
425
struct ltt_session *ltt_session_create(void);
426
int ltt_session_enable(struct ltt_session *session);
427
int ltt_session_disable(struct ltt_session *session);
428
void ltt_session_destroy(struct ltt_session *session);
470
struct lttng_session *lttng_session_create(void);
471
int lttng_session_enable(struct lttng_session *session);
472
int lttng_session_disable(struct lttng_session *session);
473
void lttng_session_destroy(struct lttng_session *session);
430
struct ltt_channel *ltt_channel_create(struct ltt_session *session,
475
struct lttng_channel *lttng_channel_create(struct lttng_session *session,
431
476
const char *transport_name,
433
478
size_t subbuf_size, size_t num_subbuf,
435
480
unsigned int read_timer_interval,
436
481
int **shm_fd, int **wait_fd,
437
482
uint64_t **memory_map_size,
438
struct ltt_channel *chan_priv_init);
439
struct ltt_channel *ltt_global_channel_create(struct ltt_session *session,
483
struct lttng_channel *chan_priv_init);
484
struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
440
485
int overwrite, void *buf_addr,
441
486
size_t subbuf_size, size_t num_subbuf,
442
487
unsigned int switch_timer_interval,
444
489
int **shm_fd, int **wait_fd,
445
490
uint64_t **memory_map_size);
447
int ltt_event_create(struct ltt_channel *chan,
492
int lttng_channel_enable(struct lttng_channel *channel);
493
int lttng_channel_disable(struct lttng_channel *channel);
495
struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
448
496
struct lttng_ust_event *event_param,
449
struct ltt_event **event);
451
int ltt_channel_enable(struct ltt_channel *channel);
452
int ltt_channel_disable(struct ltt_channel *channel);
453
int ltt_event_enable(struct ltt_event *event);
454
int ltt_event_disable(struct ltt_event *event);
456
void ltt_transport_register(struct ltt_transport *transport);
457
void ltt_transport_unregister(struct ltt_transport *transport);
497
struct lttng_channel *chan);
498
int lttng_enabler_enable(struct lttng_enabler *enabler);
499
int lttng_enabler_disable(struct lttng_enabler *enabler);
500
int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
501
struct lttng_ust_filter_bytecode_node *bytecode);
502
int lttng_enabler_attach_context(struct lttng_enabler *enabler,
503
struct lttng_ust_context *ctx);
505
int lttng_attach_context(struct lttng_ust_context *context_param,
506
struct lttng_ctx **ctx, struct lttng_session *session);
508
void lttng_transport_register(struct lttng_transport *transport);
509
void lttng_transport_unregister(struct lttng_transport *transport);
459
511
void synchronize_trace(void);
461
int ltt_probe_register(struct lttng_probe_desc *desc);
462
void ltt_probe_unregister(struct lttng_probe_desc *desc);
463
int pending_probe_fix_events(const struct lttng_event_desc *desc);
464
const struct lttng_event_desc *ltt_event_get(const char *name);
465
void ltt_event_put(const struct lttng_event_desc *desc);
466
int ltt_probes_init(void);
467
void ltt_probes_exit(void);
513
int lttng_probe_register(struct lttng_probe_desc *desc);
514
void lttng_probe_unregister(struct lttng_probe_desc *desc);
515
int lttng_fix_pending_event_desc(const struct lttng_event_desc *desc);
516
const struct lttng_event_desc *lttng_event_get(const char *name);
517
void lttng_event_put(const struct lttng_event_desc *desc);
518
int lttng_probes_init(void);
519
void lttng_probes_exit(void);
468
520
int lttng_find_context(struct lttng_ctx *ctx, const char *name);
469
521
struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p);
470
522
void lttng_remove_context_field(struct lttng_ctx **ctx_p,
481
533
extern const struct lttng_ust_lib_ring_buffer_client_cb *lttng_client_callbacks_discard;
482
534
extern const struct lttng_ust_lib_ring_buffer_client_cb *lttng_client_callbacks_overwrite;
484
struct ltt_transport *ltt_transport_find(const char *name);
536
struct lttng_transport *lttng_transport_find(const char *name);
486
int ltt_probes_get_event_list(struct lttng_ust_tracepoint_list *list);
487
void ltt_probes_prune_event_list(struct lttng_ust_tracepoint_list *list);
538
int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list);
539
void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list);
488
540
struct lttng_ust_tracepoint_iter *
489
541
lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list);
490
int ltt_probes_get_field_list(struct lttng_ust_field_list *list);
491
void ltt_probes_prune_field_list(struct lttng_ust_field_list *list);
542
int lttng_probes_get_field_list(struct lttng_ust_field_list *list);
543
void lttng_probes_prune_field_list(struct lttng_ust_field_list *list);
492
544
struct lttng_ust_field_iter *
493
545
lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list);
495
int ltt_wildcard_enable(struct session_wildcard *wildcard);
496
int ltt_wildcard_disable(struct session_wildcard *wildcard);
497
int ltt_wildcard_create(struct ltt_channel *chan,
498
struct lttng_ust_event *event_param,
499
struct session_wildcard **sl);
500
int ltt_loglevel_match(const struct lttng_event_desc *desc,
501
enum lttng_ust_loglevel_type req_type,
503
void ltt_probes_create_wildcard_events(struct wildcard_entry *entry,
504
struct session_wildcard *wildcard);
505
int lttng_filter_event_attach_bytecode(struct ltt_event *event,
506
struct lttng_ust_filter_bytecode *filter);
507
int lttng_filter_wildcard_attach_bytecode(struct session_wildcard *wildcard,
508
struct lttng_ust_filter_bytecode *filter);
509
void lttng_filter_event_link_bytecode(struct ltt_event *event,
510
struct lttng_ust_filter_bytecode *filter_bytecode);
511
void lttng_filter_wildcard_link_bytecode(struct session_wildcard *wildcard);
547
void lttng_filter_event_link_bytecode(struct lttng_event *event);
548
void lttng_enabler_event_link_bytecode(struct lttng_event *event,
549
struct lttng_enabler *enabler);
550
void lttng_free_event_filter_runtime(struct lttng_event *event);
551
void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
553
struct cds_list_head *lttng_get_probe_list_head(void);
513
555
#endif /* _LTTNG_UST_EVENTS_H */