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