~ubuntu-branches/ubuntu/wily/ust/wily-proposed

« back to all changes in this revision

Viewing changes to include/lttng/ust-events.h

  • Committer: Package Import Robot
  • Author(s): Jon Bernard, 13cb8e9
  • Date: 2012-11-27 14:14:40 UTC
  • mfrom: (11.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20121127141440-ww1wjoc93nkxhj64
[13cb8e9] New upstream version 2.1.0~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#define LTTNG_UST_UUID_LEN              16
31
31
 
32
 
struct ltt_channel;
33
 
struct ltt_session;
 
32
struct lttng_channel;
 
33
struct lttng_session;
34
34
struct lttng_ust_lib_ring_buffer_ctx;
35
35
 
36
36
/*
52
52
/* Type description */
53
53
 
54
54
/* Update the astract_types name table in lttng-types.c along with this enum */
55
 
enum abstract_types {
 
55
enum lttng_abstract_types {
56
56
        atype_integer,
57
57
        atype_enum,
58
58
        atype_array,
147
147
};
148
148
 
149
149
struct lttng_basic_type {
150
 
        enum abstract_types atype;
 
150
        enum lttng_abstract_types atype;
151
151
        union {
152
152
                union _lttng_basic_type basic;
153
153
        } u;
155
155
 
156
156
#define LTTNG_UST_TYPE_PADDING  128
157
157
struct lttng_type {
158
 
        enum abstract_types atype;
 
158
        enum lttng_abstract_types atype;
159
159
        union {
160
160
                union _lttng_basic_type basic;
161
161
                struct {
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);
205
205
        union {
206
206
                char padding[LTTNG_UST_CTX_FIELD_PADDING];
207
207
        } u;
225
225
        unsigned int nr_fields;
226
226
        const int **loglevel;
227
227
        const char *signature;  /* Argument types/names received */
228
 
        char padding[LTTNG_UST_EVENT_DESC_PADDING];
 
228
        union {
 
229
                struct {
 
230
                        const char **model_emf_uri;
 
231
                } ext;
 
232
                char padding[LTTNG_UST_EVENT_DESC_PADDING];
 
233
        } u;
229
234
};
230
235
 
231
236
#define LTTNG_UST_PROBE_DESC_PADDING    40
239
244
 
240
245
/* Data structures used by the tracer. */
241
246
 
 
247
enum lttng_enabler_type {
 
248
        LTTNG_ENABLER_WILDCARD,
 
249
        LTTNG_ENABLER_EVENT,
 
250
};
 
251
 
242
252
/*
243
 
 * Entry describing a per-session active wildcard, along with the event
244
 
 * attribute and channel information configuring the events that need to
245
 
 * be enabled.
 
253
 * Enabler field, within whatever object is enabling an event. Target of
 
254
 * backward reference.
246
255
 */
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;
 
258
 
 
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 */
 
262
 
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;
257
267
};
258
268
 
259
 
/*
260
 
 * Entry describing an active wildcard (per name) for all sessions.
261
 
 */
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;
269
 
        int loglevel;
270
 
        char name[0];
271
 
};
272
 
 
273
269
struct tp_list_entry {
274
270
        struct lttng_ust_tracepoint_iter tp;
275
271
        struct cds_list_head head;
291
287
};
292
288
 
293
289
struct ust_pending_probe;
294
 
struct ltt_event;
295
 
struct lttng_ust_filter_bytecode;
296
 
 
297
 
/*
298
 
 * ltt_event structure is referred to by the tracing fast path. It must be
299
 
 * kept small.
 
290
struct lttng_event;
 
291
 
 
292
struct lttng_ust_filter_bytecode_node {
 
293
        struct cds_list_head node;
 
294
        struct lttng_enabler *enabler;
 
295
        /*
 
296
         * struct lttng_ust_filter_bytecode has var. sized array, must
 
297
         * be last field.
 
298
         */
 
299
        struct lttng_ust_filter_bytecode bc;
 
300
};
 
301
 
 
302
/*
 
303
 * Filter return value masks.
 
304
 */
 
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. */
 
309
};
 
310
 
 
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);
 
315
        int link_failed;
 
316
        struct cds_list_head node;      /* list of bytecode runtime in event */
 
317
};
 
318
 
 
319
/*
 
320
 * Objects in a linked-list of enablers, owned by an event.
 
321
 */
 
322
struct lttng_enabler_ref {
 
323
        struct cds_list_head node;              /* enabler ref list */
 
324
        struct lttng_enabler *ref;              /* backward ref */
 
325
};
 
326
 
 
327
/*
 
328
 * lttng_event structure is referred to by the tracing fast path. It
 
329
 * must be kept small.
300
330
 *
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
303
333
 * removed.
304
334
 */
305
 
struct ltt_event {
 
335
struct lttng_event {
306
336
        /* LTTng-UST 2.0 starts here */
307
337
        unsigned int id;
308
 
        struct ltt_channel *chan;
 
338
        struct lttng_channel *chan;
309
339
        int enabled;
310
340
        const struct lttng_event_desc *desc;
311
 
        int (*filter)(void *filter_data, const char *filter_stack_data);
 
341
        void *_deprecated1;
312
342
        struct lttng_ctx *ctx;
313
343
        enum lttng_ust_instrumentation instrumentation;
314
344
        union {
315
345
        } u;
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;
 
348
        void *_deprecated3;
319
349
        unsigned int metadata_dumped:1;
 
350
 
320
351
        /* LTTng-UST 2.1 starts here */
321
 
        struct lttng_ust_filter_bytecode *filter_bytecode;
322
 
        void *filter_data;
 
352
        /* list of struct lttng_bytecode_runtime, sorted by seqnum */
 
353
        struct cds_list_head bytecode_runtime_head;
 
354
 
 
355
        /* Backward references: list of lttng_enabler_ref (ref to enablers) */
 
356
        struct cds_list_head enablers_ref_head;
323
357
};
324
358
 
325
359
struct channel;
330
364
 * UST. Fields need to be only added at the end, never reordered, never
331
365
 * removed.
332
366
 */
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,
335
369
                                void *buf_addr,
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,
370
404
 * UST. Fields need to be only added at the end, never reordered, never
371
405
 * removed.
372
406
 */
373
 
struct ltt_channel {
 
407
struct lttng_channel {
374
408
        /*
375
409
         * The pointers located in this private data are NOT safe to be
376
410
         * dereferenced by the consumer. The only operations the
381
415
        int enabled;
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 */
398
432
};
399
433
 
 
434
#define LTTNG_UST_EVENT_HT_BITS         6
 
435
#define LTTNG_UST_EVENT_HT_SIZE         (1U << LTTNG_UST_EVENT_HT_BITS)
 
436
 
 
437
struct lttng_ust_event_ht {
 
438
        struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
 
439
};
 
440
 
400
441
/*
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
403
444
 * removed.
404
445
 */
405
 
struct ltt_session {
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;
 
458
 
 
459
        /* New UST 2.1 */
 
460
        /* List of enablers */
 
461
        struct cds_list_head enablers_head;
417
462
};
418
463
 
419
 
struct ltt_transport {
 
464
struct lttng_transport {
420
465
        char *name;
421
466
        struct cds_list_head node;
422
 
        struct ltt_channel_ops ops;
 
467
        struct lttng_channel_ops ops;
423
468
};
424
469
 
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);
429
474
 
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,
432
477
                                       void *buf_addr,
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);
446
491
 
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);
 
494
 
 
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);
450
 
 
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);
455
 
 
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);
 
504
 
 
505
int lttng_attach_context(struct lttng_ust_context *context_param,
 
506
                struct lttng_ctx **ctx, struct lttng_session *session);
 
507
 
 
508
void lttng_transport_register(struct lttng_transport *transport);
 
509
void lttng_transport_unregister(struct lttng_transport *transport);
458
510
 
459
511
void synchronize_trace(void);
460
512
 
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;
483
535
 
484
 
struct ltt_transport *ltt_transport_find(const char *name);
 
536
struct lttng_transport *lttng_transport_find(const char *name);
485
537
 
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);
494
546
 
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,
502
 
                int req_loglevel);
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);
 
552
 
 
553
struct cds_list_head *lttng_get_probe_list_head(void);
512
554
 
513
555
#endif /* _LTTNG_UST_EVENTS_H */