Commit | Line | Data |
---|---|---|
11b5a3c2 MD |
1 | #ifndef _LTT_EVENTS_H |
2 | #define _LTT_EVENTS_H | |
3 | ||
4e3c1b9b MD |
4 | /* |
5 | * ltt-events.h | |
6 | * | |
7 | * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * Holds LTTng per-session event registry. | |
10 | */ | |
11 | ||
12 | #include <linux/list.h> | |
11b5a3c2 | 13 | #include "ltt-debugfs-abi.h" |
4e3c1b9b MD |
14 | |
15 | struct ltt_channel; | |
16 | struct ltt_session; | |
1c25284c | 17 | struct lib_ring_buffer_ctx; |
4e3c1b9b MD |
18 | |
19 | /* | |
20 | * ltt_event structure is referred to by the tracing fast path. It must be | |
21 | * kept small. | |
22 | */ | |
23 | struct ltt_event { | |
24 | unsigned int id; | |
25 | struct ltt_channel *chan; | |
baf20995 | 26 | void *probe; |
4e3c1b9b MD |
27 | void *filter; |
28 | char *name; | |
baf20995 | 29 | enum instrum_type itype; |
4e3c1b9b MD |
30 | struct list_head list; /* Event list */ |
31 | }; | |
32 | ||
11b5a3c2 MD |
33 | struct ltt_channel_ops { |
34 | struct channel *(*channel_create)(const char *name, | |
35 | struct ltt_session *session, | |
36 | void *buf_addr, | |
37 | size_t subbuf_size, size_t num_subbuf, | |
38 | unsigned int switch_timer_interval, | |
39 | unsigned int read_timer_interval); | |
40 | void (*channel_destroy)(struct channel *chan); | |
41 | struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); | |
1c25284c MD |
42 | void (*buffer_read_close)(struct lib_ring_buffer *buf); |
43 | int (*event_reserve)(struct lib_ring_buffer_ctx *ctx); | |
44 | void (*event_commit)(struct lib_ring_buffer_ctx *ctx); | |
11b5a3c2 MD |
45 | }; |
46 | ||
4e3c1b9b MD |
47 | struct ltt_channel { |
48 | struct channel *chan; /* Channel buffers */ | |
49 | /* Event ID management */ | |
50 | struct ltt_session *session; | |
d4e1a740 | 51 | struct file *file; /* File associated to channel */ |
e5382b6d | 52 | unsigned int free_event_id; /* Next event ID to allocate */ |
4e3c1b9b | 53 | struct list_head list; /* Channel list */ |
653fe716 | 54 | wait_queue_head_t notify_wait; /* Channel addition notif. waitqueue */ |
11b5a3c2 | 55 | struct ltt_channel_ops *ops; |
4e3c1b9b MD |
56 | }; |
57 | ||
58 | struct ltt_session { | |
e5382b6d | 59 | int active; /* Is trace session active ? */ |
d4e1a740 | 60 | struct file *file; /* File associated to session */ |
4e3c1b9b MD |
61 | struct list_head chan; /* Channel list head */ |
62 | struct list_head events; /* Event list head */ | |
63 | struct list_head list; /* Session list */ | |
4e3c1b9b MD |
64 | }; |
65 | ||
c0e31d2e MD |
66 | struct ltt_transport { |
67 | char *name; | |
68 | struct module *owner; | |
69 | struct list_head node; | |
11b5a3c2 | 70 | struct ltt_channel_ops ops; |
c0e31d2e MD |
71 | }; |
72 | ||
baf20995 | 73 | struct ltt_session *ltt_session_create(void); |
c0e31d2e MD |
74 | int ltt_session_start(struct ltt_session *session); |
75 | int ltt_session_stop(struct ltt_session *session); | |
11b5a3c2 | 76 | void ltt_session_destroy(struct ltt_session *session); |
4e3c1b9b | 77 | |
baf20995 | 78 | struct ltt_channel *ltt_channel_create(struct ltt_session *session, |
4e3c1b9b MD |
79 | int overwrite, void *buf_addr, |
80 | size_t subbuf_size, size_t num_subbuf, | |
81 | unsigned int switch_timer_interval, | |
82 | unsigned int read_timer_interval); | |
11b5a3c2 | 83 | void _ltt_channel_destroy(struct ltt_channel *chan); |
4e3c1b9b | 84 | |
653fe716 | 85 | struct ltt_event *ltt_event_create(struct ltt_channel *chan, |
653fe716 | 86 | char *name, |
11b5a3c2 MD |
87 | enum instrum_type itype, |
88 | void *probe, void *filter); | |
4e3c1b9b | 89 | int _ltt_event_destroy(struct ltt_event *event); |
c0e31d2e MD |
90 | |
91 | void ltt_transport_register(struct ltt_transport *transport); | |
92 | void ltt_transport_unregister(struct ltt_transport *transport); | |
11b5a3c2 | 93 | |
1c25284c MD |
94 | int ltt_debugfs_abi_init(void); |
95 | void ltt_debugfs_abi_exit(void); | |
96 | ||
11b5a3c2 | 97 | #endif /* _LTT_EVENTS_H */ |