Move the ringbuffer and counter clients to 'src/common/'
[lttng-ust.git] / src / lib / lttng-ust / events.h
CommitLineData
36c52fff
MJ
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2019 (c) Francis Deslauriers <francis.deslauriers@efficios.com>
5 */
6
7#ifndef _LTTNG_UST_EVENTS_INTERNAL_H
8#define _LTTNG_UST_EVENTS_INTERNAL_H
9
10#include "common/events.h"
11
12/*
13 * Allocate and initialize a `struct lttng_event_enabler` object.
14 *
15 * On success, returns a `struct lttng_event_enabler`,
16 * On memory error, returns NULL.
17 */
18struct lttng_event_enabler *lttng_event_enabler_create(
19 enum lttng_enabler_format_type format_type,
20 struct lttng_ust_abi_event *event_param,
21 struct lttng_ust_channel_buffer *chan)
22 __attribute__((visibility("hidden")));
23
24/*
25 * Destroy a `struct lttng_event_enabler` object.
26 */
27void lttng_event_enabler_destroy(struct lttng_event_enabler *enabler)
28 __attribute__((visibility("hidden")));
29
30/*
31 * Enable a `struct lttng_event_enabler` object and all events related to this
32 * enabler.
33 */
34int lttng_event_enabler_enable(struct lttng_event_enabler *enabler)
35 __attribute__((visibility("hidden")));
36
37/*
38 * Disable a `struct lttng_event_enabler` object and all events related to this
39 * enabler.
40 */
41int lttng_event_enabler_disable(struct lttng_event_enabler *enabler)
42 __attribute__((visibility("hidden")));
43
44/*
45 * Attach filter bytecode program to `struct lttng_event_enabler` and all
46 * events related to this enabler.
47 */
48int lttng_event_enabler_attach_filter_bytecode(
49 struct lttng_event_enabler *enabler,
50 struct lttng_ust_bytecode_node **bytecode)
51 __attribute__((visibility("hidden")));
52
53/*
54 * Attach an application context to an event enabler.
55 *
56 * Not implemented.
57 */
58int lttng_event_enabler_attach_context(struct lttng_event_enabler *enabler,
59 struct lttng_ust_abi_context *ctx)
60 __attribute__((visibility("hidden")));
61
62/*
63 * Attach exclusion list to `struct lttng_event_enabler` and all
64 * events related to this enabler.
65 */
66int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *enabler,
67 struct lttng_ust_excluder_node **excluder)
68 __attribute__((visibility("hidden")));
69
70/*
71 * Synchronize bytecodes for the enabler and the instance (event or
72 * event_notifier).
73 *
74 * This function goes over all bytecode programs of the enabler (event or
75 * event_notifier enabler) to ensure each is linked to the provided instance.
76 */
77void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc,
78 struct lttng_ust_ctx **ctx,
79 struct cds_list_head *instance_bytecode_runtime_head,
80 struct cds_list_head *enabler_bytecode_runtime_head)
81 __attribute__((visibility("hidden")));
82
83/*
84 * Allocate and initialize a `struct lttng_event_notifier_group` object.
85 *
86 * On success, returns a `struct lttng_triggre_group`,
87 * on memory error, returns NULL.
88 */
89struct lttng_event_notifier_group *lttng_event_notifier_group_create(void)
90 __attribute__((visibility("hidden")));
91
92/*
93 * Destroy a `struct lttng_event_notifier_group` object.
94 */
95void lttng_event_notifier_group_destroy(
96 struct lttng_event_notifier_group *event_notifier_group)
97 __attribute__((visibility("hidden")));
98
99/*
100 * Allocate and initialize a `struct lttng_event_notifier_enabler` object.
101 *
102 * On success, returns a `struct lttng_event_notifier_enabler`,
103 * On memory error, returns NULL.
104 */
105struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
106 struct lttng_event_notifier_group *event_notifier_group,
107 enum lttng_enabler_format_type format_type,
108 struct lttng_ust_abi_event_notifier *event_notifier_param)
109 __attribute__((visibility("hidden")));
110
111/*
112 * Destroy a `struct lttng_event_notifier_enabler` object.
113 */
114void lttng_event_notifier_enabler_destroy(
115 struct lttng_event_notifier_enabler *event_notifier_enabler)
116 __attribute__((visibility("hidden")));
117
118/*
119 * Enable a `struct lttng_event_notifier_enabler` object and all event
120 * notifiers related to this enabler.
121 */
122int lttng_event_notifier_enabler_enable(
123 struct lttng_event_notifier_enabler *event_notifier_enabler)
124 __attribute__((visibility("hidden")));
125
126/*
127 * Disable a `struct lttng_event_notifier_enabler` object and all event
128 * notifiers related to this enabler.
129 */
130int lttng_event_notifier_enabler_disable(
131 struct lttng_event_notifier_enabler *event_notifier_enabler)
132 __attribute__((visibility("hidden")));
133
134/*
135 * Attach filter bytecode program to `struct lttng_event_notifier_enabler` and
136 * all event notifiers related to this enabler.
137 */
138int lttng_event_notifier_enabler_attach_filter_bytecode(
139 struct lttng_event_notifier_enabler *event_notifier_enabler,
140 struct lttng_ust_bytecode_node **bytecode)
141 __attribute__((visibility("hidden")));
142
143/*
144 * Attach capture bytecode program to `struct lttng_event_notifier_enabler` and
145 * all event_notifiers related to this enabler.
146 */
147int lttng_event_notifier_enabler_attach_capture_bytecode(
148 struct lttng_event_notifier_enabler *event_notifier_enabler,
149 struct lttng_ust_bytecode_node **bytecode)
150 __attribute__((visibility("hidden")));
151
152/*
153 * Attach exclusion list to `struct lttng_event_notifier_enabler` and all
154 * event notifiers related to this enabler.
155 */
156int lttng_event_notifier_enabler_attach_exclusion(
157 struct lttng_event_notifier_enabler *event_notifier_enabler,
158 struct lttng_ust_excluder_node **excluder)
159 __attribute__((visibility("hidden")));
160
161void lttng_free_event_filter_runtime(struct lttng_ust_event_common *event)
162 __attribute__((visibility("hidden")));
163
164/*
165 * Connect the probe on all enablers matching this event description.
166 * Called on library load.
167 */
168int lttng_fix_pending_event_notifiers(void)
169 __attribute__((visibility("hidden")));
170
171struct lttng_counter *lttng_ust_counter_create(
172 const char *counter_transport_name,
173 size_t number_dimensions, const struct lttng_counter_dimension *dimensions)
174 __attribute__((visibility("hidden")));
175
176#ifdef HAVE_LINUX_PERF_EVENT_H
177
178int lttng_add_perf_counter_to_ctx(uint32_t type,
179 uint64_t config,
180 const char *name,
181 struct lttng_ust_ctx **ctx)
182 __attribute__((visibility("hidden")));
183
184int lttng_perf_counter_init(void)
185 __attribute__((visibility("hidden")));
186
187void lttng_perf_counter_exit(void)
188 __attribute__((visibility("hidden")));
189
190#else /* #ifdef HAVE_LINUX_PERF_EVENT_H */
191
192static inline
e2a195a6
MJ
193int lttng_add_perf_counter_to_ctx(uint32_t type __attribute__((unused)),
194 uint64_t config __attribute__((unused)),
195 const char *name __attribute__((unused)),
196 struct lttng_ust_ctx **ctx __attribute__((unused)))
36c52fff
MJ
197{
198 return -ENOSYS;
199}
200static inline
201int lttng_perf_counter_init(void)
202{
203 return 0;
204}
205static inline
206void lttng_perf_counter_exit(void)
207{
208}
209#endif /* #else #ifdef HAVE_LINUX_PERF_EVENT_H */
210
211int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list)
212 __attribute__((visibility("hidden")));
213
214void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list)
215 __attribute__((visibility("hidden")));
216
217int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
218 __attribute__((visibility("hidden")));
219
220void lttng_probes_prune_field_list(struct lttng_ust_field_list *list)
221 __attribute__((visibility("hidden")));
222
223struct lttng_ust_abi_tracepoint_iter *
224 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list)
225 __attribute__((visibility("hidden")));
226
227struct lttng_ust_abi_field_iter *
228 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list)
229 __attribute__((visibility("hidden")));
230
231struct lttng_ust_session *lttng_session_create(void)
232 __attribute__((visibility("hidden")));
233
234int lttng_session_enable(struct lttng_ust_session *session)
235 __attribute__((visibility("hidden")));
236
237int lttng_session_disable(struct lttng_ust_session *session)
238 __attribute__((visibility("hidden")));
239
240int lttng_session_statedump(struct lttng_ust_session *session)
241 __attribute__((visibility("hidden")));
242
243void lttng_session_destroy(struct lttng_ust_session *session)
244 __attribute__((visibility("hidden")));
245
246/*
247 * Called with ust lock held.
248 */
249int lttng_session_active(void)
250 __attribute__((visibility("hidden")));
251
252struct cds_list_head *lttng_get_sessions(void)
253 __attribute__((visibility("hidden")));
254
255void lttng_handle_pending_statedump(void *owner)
256 __attribute__((visibility("hidden")));
257
258int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel)
259 __attribute__((visibility("hidden")));
260
261int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel)
262 __attribute__((visibility("hidden")));
263
36c52fff
MJ
264void lttng_probe_provider_unregister_events(const struct lttng_ust_probe_desc *desc)
265 __attribute__((visibility("hidden")));
266
267int lttng_fix_pending_events(void)
268 __attribute__((visibility("hidden")));
269
270struct cds_list_head *lttng_get_probe_list_head(void)
271 __attribute__((visibility("hidden")));
272
273int lttng_abi_create_root_handle(void)
274 __attribute__((visibility("hidden")));
275
276const struct lttng_ust_abi_objd_ops *lttng_ust_abi_objd_ops(int id)
277 __attribute__((visibility("hidden")));
278
279int lttng_ust_abi_objd_unref(int id, int is_owner)
280 __attribute__((visibility("hidden")));
281
282void lttng_ust_abi_exit(void)
283 __attribute__((visibility("hidden")));
284
285void lttng_ust_abi_events_exit(void)
286 __attribute__((visibility("hidden")));
287
288void lttng_ust_abi_objd_table_owner_cleanup(void *owner)
289 __attribute__((visibility("hidden")));
290
9c098f23 291int lttng_ust_interpret_event_filter(const struct lttng_ust_event_common *event,
36c52fff 292 const char *interpreter_stack_data,
b2e37d27 293 struct lttng_ust_probe_ctx *probe_ctx,
36c52fff
MJ
294 void *filter_ctx)
295 __attribute__((visibility("hidden")));
296
297int lttng_ust_session_uuid_validate(struct lttng_ust_session *session,
298 unsigned char *uuid)
299 __attribute__((visibility("hidden")));
300
301bool lttng_ust_validate_event_name(const struct lttng_ust_event_desc *desc)
302 __attribute__((visibility("hidden")));
303
304void lttng_ust_format_event_name(const struct lttng_ust_event_desc *desc,
305 char *name)
306 __attribute__((visibility("hidden")));
307
308int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ust_ctx **ctx)
309 __attribute__((visibility("hidden")));
310
311int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
312 const char *name,
b2e37d27
MD
313 size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
314 size_t offset),
315 void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
316 struct lttng_ust_ring_buffer_ctx *ctx,
36c52fff 317 struct lttng_ust_channel_buffer *chan),
b2e37d27
MD
318 void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
319 struct lttng_ust_ctx_value *value),
36c52fff
MJ
320 void *priv)
321 __attribute__((visibility("hidden")));
322
323void lttng_ust_context_set_session_provider(const char *name,
b2e37d27
MD
324 size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
325 size_t offset),
326 void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
327 struct lttng_ust_ring_buffer_ctx *ctx,
36c52fff 328 struct lttng_ust_channel_buffer *chan),
b2e37d27
MD
329 void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
330 struct lttng_ust_ctx_value *value),
36c52fff
MJ
331 void *priv)
332 __attribute__((visibility("hidden")));
333
334#endif /* _LTTNG_UST_EVENTS_INTERNAL_H */
This page took 0.034734 seconds and 4 git commands to generate.