1 // SPDX-FileCopyrightText: 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 // SPDX-License-Identifier: MIT
5 #ifndef _LTTNG_UST_TRACEPOINT_H
6 #define _LTTNG_UST_TRACEPOINT_H
10 #include <lttng/tracepoint-types.h>
11 #include <lttng/tracepoint-rcu.h>
12 #include <lttng/ust-utils.h>
13 #include <sys/types.h>
16 #include <urcu/compiler.h>
17 #include <urcu/system.h>
18 #include <dlfcn.h> /* for dlopen */
19 #include <string.h> /* for memset */
22 #include <lttng/ust-config.h> /* for sdt */
23 #include <lttng/ust-compiler.h>
24 #include <lttng/ust-tracer.h>
25 #include <lttng/ust-api-compat.h>
27 #if (defined(__cplusplus) && (__cplusplus <= 199711L))
28 #error "C++11 support is required to build tracepoints and providers as C++"
31 #define LTTNG_UST_TRACEPOINT_NAME_LEN_MAX 256
33 #ifdef LTTNG_UST_HAVE_SDT_INTEGRATION
35 * Instead of using SDT_USE_VARIADIC from 'sys/sdt.h', use our own namespaced
36 * macros since the instrumented application might already have included
37 * 'sys/sdt.h' without variadic support.
41 #define LTTNG_UST__SDT_NARG(...) \
42 LTTNG_UST___SDT_NARG(__VA_ARGS__, 12,11,10,9,8,7,6,5,4,3,2,1,0)
44 #define LTTNG_UST___SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12, N, ...) N
46 #define LTTNG_UST__SDT_PROBE_N(provider, name, N, ...) \
47 _SDT_PROBE(provider, name, N, (__VA_ARGS__))
49 #define LTTNG_UST_STAP_PROBEV(provider, name, ...) \
50 LTTNG_UST__SDT_PROBE_N(provider, name, LTTNG_UST__SDT_NARG(0, ##__VA_ARGS__), ##__VA_ARGS__)
53 #define LTTNG_UST_STAP_PROBEV(...)
60 #define lttng_ust_tracepoint_enabled(provider, name) \
61 caa_unlikely(CMM_LOAD_SHARED(lttng_ust_tracepoint_##provider##___##name.state))
63 #define lttng_ust_do_tracepoint(provider, name, ...) \
64 lttng_ust_tracepoint_cb_##provider##___##name(__VA_ARGS__)
66 #define lttng_ust_tracepoint(provider, name, ...) \
68 LTTNG_UST_STAP_PROBEV(provider, name, ## __VA_ARGS__); \
69 if (lttng_ust_tracepoint_enabled(provider, name)) \
70 lttng_ust_do_tracepoint(provider, name, __VA_ARGS__); \
73 #define LTTNG_UST_TP_ARGS(...) __VA_ARGS__
76 * LTTNG_UST_TP_ARGS takes tuples of type, argument separated by a comma.
77 * It can take up to 10 tuples (which means that less than 10 tuples is
79 * Each tuple is also separated by a comma.
81 #define LTTNG_UST___TP_COMBINE_TOKENS(_tokena, _tokenb) \
83 #define LTTNG_UST__TP_COMBINE_TOKENS(_tokena, _tokenb) \
84 LTTNG_UST___TP_COMBINE_TOKENS(_tokena, _tokenb)
85 #define LTTNG_UST___TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \
86 _tokena##_tokenb##_tokenc
87 #define LTTNG_UST__TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc) \
88 LTTNG_UST___TP_COMBINE_TOKENS3(_tokena, _tokenb, _tokenc)
89 #define LTTNG_UST___TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \
90 _tokena##_tokenb##_tokenc##_tokend
91 #define LTTNG_UST__TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend) \
92 LTTNG_UST___TP_COMBINE_TOKENS4(_tokena, _tokenb, _tokenc, _tokend)
95 * LTTNG_UST__TP_EXVAR* extract the var names.
96 * LTTNG_UST__TP_EXVAR1 and LTTNG_UST__TP_EXDATA_VAR1 are needed for -std=c99.
98 #define LTTNG_UST__TP_EXVAR0()
99 #define LTTNG_UST__TP_EXVAR1(a)
100 #define LTTNG_UST__TP_EXVAR2(a,b) b
101 #define LTTNG_UST__TP_EXVAR4(a,b,c,d) b,d
102 #define LTTNG_UST__TP_EXVAR6(a,b,c,d,e,f) b,d,f
103 #define LTTNG_UST__TP_EXVAR8(a,b,c,d,e,f,g,h) b,d,f,h
104 #define LTTNG_UST__TP_EXVAR10(a,b,c,d,e,f,g,h,i,j) b,d,f,h,j
105 #define LTTNG_UST__TP_EXVAR12(a,b,c,d,e,f,g,h,i,j,k,l) b,d,f,h,j,l
106 #define LTTNG_UST__TP_EXVAR14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) b,d,f,h,j,l,n
107 #define LTTNG_UST__TP_EXVAR16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) b,d,f,h,j,l,n,p
108 #define LTTNG_UST__TP_EXVAR18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) b,d,f,h,j,l,n,p,r
109 #define LTTNG_UST__TP_EXVAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) b,d,f,h,j,l,n,p,r,t
111 #define LTTNG_UST__TP_EXDATA_VAR0() __tp_data
112 #define LTTNG_UST__TP_EXDATA_VAR1(a) __tp_data
113 #define LTTNG_UST__TP_EXDATA_VAR2(a,b) __tp_data,b
114 #define LTTNG_UST__TP_EXDATA_VAR4(a,b,c,d) __tp_data,b,d
115 #define LTTNG_UST__TP_EXDATA_VAR6(a,b,c,d,e,f) __tp_data,b,d,f
116 #define LTTNG_UST__TP_EXDATA_VAR8(a,b,c,d,e,f,g,h) __tp_data,b,d,f,h
117 #define LTTNG_UST__TP_EXDATA_VAR10(a,b,c,d,e,f,g,h,i,j) __tp_data,b,d,f,h,j
118 #define LTTNG_UST__TP_EXDATA_VAR12(a,b,c,d,e,f,g,h,i,j,k,l) __tp_data,b,d,f,h,j,l
119 #define LTTNG_UST__TP_EXDATA_VAR14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) __tp_data,b,d,f,h,j,l,n
120 #define LTTNG_UST__TP_EXDATA_VAR16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) __tp_data,b,d,f,h,j,l,n,p
121 #define LTTNG_UST__TP_EXDATA_VAR18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) __tp_data,b,d,f,h,j,l,n,p,r
122 #define LTTNG_UST__TP_EXDATA_VAR20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) __tp_data,b,d,f,h,j,l,n,p,r,t
125 * LTTNG_UST__TP_EXPROTO* extract tuples of type, var.
126 * LTTNG_UST__TP_EXPROTO1 and LTTNG_UST__TP_EXDATA_PROTO1 are needed for -std=c99.
128 #define LTTNG_UST__TP_EXPROTO0() void
129 #define LTTNG_UST__TP_EXPROTO1(a) void
130 #define LTTNG_UST__TP_EXPROTO2(a,b) a b
131 #define LTTNG_UST__TP_EXPROTO4(a,b,c,d) a b,c d
132 #define LTTNG_UST__TP_EXPROTO6(a,b,c,d,e,f) a b,c d,e f
133 #define LTTNG_UST__TP_EXPROTO8(a,b,c,d,e,f,g,h) a b,c d,e f,g h
134 #define LTTNG_UST__TP_EXPROTO10(a,b,c,d,e,f,g,h,i,j) a b,c d,e f,g h,i j
135 #define LTTNG_UST__TP_EXPROTO12(a,b,c,d,e,f,g,h,i,j,k,l) a b,c d,e f,g h,i j,k l
136 #define LTTNG_UST__TP_EXPROTO14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) a b,c d,e f,g h,i j,k l,m n
137 #define LTTNG_UST__TP_EXPROTO16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) a b,c d,e f,g h,i j,k l,m n,o p
138 #define LTTNG_UST__TP_EXPROTO18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) a b,c d,e f,g h,i j,k l,m n,o p,q r
139 #define LTTNG_UST__TP_EXPROTO20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) a b,c d,e f,g h,i j,k l,m n,o p,q r,s t
141 #define LTTNG_UST__TP_EXDATA_PROTO0() void *__tp_data
142 #define LTTNG_UST__TP_EXDATA_PROTO1(a) void *__tp_data
143 #define LTTNG_UST__TP_EXDATA_PROTO2(a,b) void *__tp_data,a b
144 #define LTTNG_UST__TP_EXDATA_PROTO4(a,b,c,d) void *__tp_data,a b,c d
145 #define LTTNG_UST__TP_EXDATA_PROTO6(a,b,c,d,e,f) void *__tp_data,a b,c d,e f
146 #define LTTNG_UST__TP_EXDATA_PROTO8(a,b,c,d,e,f,g,h) void *__tp_data,a b,c d,e f,g h
147 #define LTTNG_UST__TP_EXDATA_PROTO10(a,b,c,d,e,f,g,h,i,j) void *__tp_data,a b,c d,e f,g h,i j
148 #define LTTNG_UST__TP_EXDATA_PROTO12(a,b,c,d,e,f,g,h,i,j,k,l) void *__tp_data,a b,c d,e f,g h,i j,k l
149 #define LTTNG_UST__TP_EXDATA_PROTO14(a,b,c,d,e,f,g,h,i,j,k,l,m,n) void *__tp_data,a b,c d,e f,g h,i j,k l,m n
150 #define LTTNG_UST__TP_EXDATA_PROTO16(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p
151 #define LTTNG_UST__TP_EXDATA_PROTO18(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p,q r
152 #define LTTNG_UST__TP_EXDATA_PROTO20(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t) void *__tp_data,a b,c d,e f,g h,i j,k l,m n,o p,q r,s t
154 /* Preprocessor trick to count arguments. Inspired from sdt.h. */
155 #define LTTNG_UST__TP_NARGS(...) LTTNG_UST___TP_NARGS(__VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
156 #define LTTNG_UST___TP_NARGS(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, N, ...) N
157 #define LTTNG_UST__TP_PROTO_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXPROTO, N)(__VA_ARGS__))
158 #define LTTNG_UST__TP_VAR_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXVAR, N)(__VA_ARGS__))
159 #define LTTNG_UST__TP_DATA_PROTO_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_PROTO, N)(__VA_ARGS__))
160 #define LTTNG_UST__TP_DATA_VAR_N(N, ...) LTTNG_UST__TP_PARAMS(LTTNG_UST__TP_COMBINE_TOKENS(LTTNG_UST__TP_EXDATA_VAR, N)(__VA_ARGS__))
161 #define LTTNG_UST__TP_ARGS_PROTO(...) LTTNG_UST__TP_PROTO_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
162 #define LTTNG_UST__TP_ARGS_VAR(...) LTTNG_UST__TP_VAR_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
163 #define LTTNG_UST__TP_ARGS_DATA_PROTO(...) LTTNG_UST__TP_DATA_PROTO_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
164 #define LTTNG_UST__TP_ARGS_DATA_VAR(...) LTTNG_UST__TP_DATA_VAR_N(LTTNG_UST__TP_NARGS(0, ##__VA_ARGS__), ##__VA_ARGS__)
165 #define LTTNG_UST__TP_PARAMS(...) __VA_ARGS__
168 * sizeof(#_provider) - 1 : length of the provider string (excluding \0).
169 * sizeof(#_name) - 1 : length of the name string (excluding \0).
170 * + 1 : separator between provider and event name.
172 * Upper bound (inclusive) is LTTNG_UST_TRACEPOINT_NAME_LEN_MAX - 1 to
176 * left hand side: sizeof(#_provider) - 1 + sizeof(#_name) - 1 + 1
177 * right hand side: LTTNG_UST_TRACEPOINT_NAME_LEN_MAX - 1
178 * operator: <= (inclusive)
179 * Simplified in the code below.
181 #define lttng_ust_tracepoint_validate_name_len(_provider, _name) \
182 lttng_ust_static_assert(sizeof(#_provider) + sizeof(#_name) <= LTTNG_UST_TRACEPOINT_NAME_LEN_MAX, \
183 "Tracepoint name length is too long", \
184 Tracepoint_name_length_is_too_long)
187 * The tracepoint cb is marked always inline so we can distinguish
188 * between caller's ip addresses within the probe using the return
191 #define LTTNG_UST__DECLARE_TRACEPOINT(_provider, _name, ...) \
192 extern struct lttng_ust_tracepoint lttng_ust_tracepoint_##_provider##___##_name \
193 LTTNG_UST__TRACEPOINT_DEFINITION_VISIBILITY; \
195 void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__VA_ARGS__)) \
196 __attribute__((always_inline, unused)) lttng_ust_notrace; \
198 void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__VA_ARGS__)) \
200 struct lttng_ust_tracepoint_probe *__tp_probe; \
202 if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST())) \
204 lttng_ust_tp_rcu_read_lock(); \
205 __tp_probe = lttng_ust_tp_rcu_dereference(lttng_ust_tracepoint_##_provider##___##_name.probes); \
206 if (caa_unlikely(!__tp_probe)) \
209 void (*__tp_cb)(void) = __tp_probe->func; \
210 void *__tp_data = __tp_probe->data; \
212 URCU_FORCE_CAST(void (*)(LTTNG_UST__TP_ARGS_DATA_PROTO(__VA_ARGS__)), __tp_cb) \
213 (LTTNG_UST__TP_ARGS_DATA_VAR(__VA_ARGS__)); \
214 } while ((++__tp_probe)->func); \
216 lttng_ust_tp_rcu_read_unlock(); \
219 void lttng_ust_tracepoint_register_##_provider##___##_name(char *provider_name, char *event_name, \
220 void (*func)(void), void *data) \
223 void lttng_ust_tracepoint_register_##_provider##___##_name(char *provider_name, char *event_name, \
224 void (*func)(void), void *data) \
226 lttng_ust_tracepoint_provider_register(provider_name, event_name, func, data, \
227 lttng_ust_tracepoint_##_provider##___##_name.signature); \
230 void lttng_ust_tracepoint_unregister_##_provider##___##_name(char *provider_name, char *event_name, \
231 void (*func)(void), void *data) \
234 void lttng_ust_tracepoint_unregister_##_provider##___##_name(char *provider_name, char *event_name, \
235 void (*func)(void), void *data) \
237 lttng_ust_tracepoint_provider_unregister(provider_name, event_name, func, data); \
241 * Registration of tracepoint provider probe functions with
242 * lttng_ust_tracepoint_provider_register, unregistration with
243 * lttng_ust_tracepoint_provider_unregister.
245 int lttng_ust_tracepoint_provider_register(const char *provider_name
, const char *event_name
,
246 void (*func
)(void), void *data
, const char *signature
);
247 int lttng_ust_tracepoint_provider_unregister(const char *provider_name
, const char *event_name
,
248 void (*func
)(void), void *data
);
251 * Registration of tracepoint instrumentation modules with lttng_ust_tracepoint_module_register,
252 * unregistration with lttng_ust_tracepoint_module_unregister.
254 int lttng_ust_tracepoint_module_register(struct lttng_ust_tracepoint
* const *tracepoints_start
,
255 int tracepoints_count
);
256 int lttng_ust_tracepoint_module_unregister(struct lttng_ust_tracepoint
* const *tracepoints_start
);
259 * tracepoint dynamic linkage handling (callbacks). Hidden visibility:
260 * shared across objects in a module/main executable.
262 * IMPORTANT: this structure is part of the ABI between instrumented
263 * applications and UST. Fields need to be only added at the end, never
264 * reordered, never removed.
266 * The field @struct_size should be used to determine the size of the
267 * structure. It should be queried before using additional fields added
268 * at the end of the structure.
270 struct lttng_ust_tracepoint_dlopen
{
271 uint32_t struct_size
;
273 void *liblttngust_handle
;
275 int (*lttng_ust_tracepoint_module_register
)(struct lttng_ust_tracepoint
* const *tracepoints_start
,
276 int tracepoints_count
);
277 int (*lttng_ust_tracepoint_module_unregister
)(struct lttng_ust_tracepoint
* const *tracepoints_start
);
278 void (*rcu_read_lock_sym
)(void);
279 void (*rcu_read_unlock_sym
)(void);
280 void *(*rcu_dereference_sym
)(void *p
);
282 /* End of base ABI. Fields below should be used after checking struct_size. */
285 extern struct lttng_ust_tracepoint_dlopen lttng_ust_tracepoint_dlopen
;
286 extern struct lttng_ust_tracepoint_dlopen
*lttng_ust_tracepoint_dlopen_ptr
;
289 * These weak symbols, the constructor, and destructor take care of
290 * registering only _one_ instance of the tracepoints per shared-ojbect
291 * (or for the whole main program).
293 int lttng_ust_tracepoint_registered
294 __attribute__((weak
, visibility("hidden")));
295 int lttng_ust_tracepoint_ptrs_registered
296 __attribute__((weak
, visibility("hidden")));
297 struct lttng_ust_tracepoint_dlopen lttng_ust_tracepoint_dlopen
298 __attribute__((weak
, visibility("hidden"))) = {
299 .struct_size
= sizeof(struct lttng_ust_tracepoint_dlopen
),
302 * Deal with gcc O1 optimisation issues with weak hidden symbols. gcc
303 * 4.8 and prior does not have the same behavior for symbol scoping on
304 * 32-bit powerpc depending on the object size: symbols for objects of 8
305 * bytes or less have the same address throughout a module, whereas they
306 * have different addresses between compile units for objects larger
307 * than 8 bytes. Add this pointer indirection to ensure that the symbol
308 * scoping match that of the other weak hidden symbols found in this
311 struct lttng_ust_tracepoint_dlopen
*lttng_ust_tracepoint_dlopen_ptr
312 __attribute__((weak
, visibility("hidden")));
315 * Tracepoint dynamic linkage handling (callbacks). Hidden visibility: shared
316 * across objects in a module/main executable. The callbacks are used to
317 * control and check if the destructors should be executed.
319 * IMPORTANT: this structure is part of the ABI between instrumented
320 * applications and UST. Fields need to be only added at the end, never
321 * reordered, never removed.
323 * The field @struct_size should be used to determine the size of the
324 * structure. It should be queried before using additional fields added
325 * at the end of the structure.
327 struct lttng_ust_tracepoint_destructors_syms
{
328 uint32_t struct_size
;
330 void (*tracepoint_disable_destructors
)(void);
331 int (*tracepoint_get_destructors_state
)(void);
333 /* End of base ABI. Fields below should be used after checking struct_size. */
336 extern struct lttng_ust_tracepoint_destructors_syms lttng_ust_tracepoint_destructors_syms
;
337 extern struct lttng_ust_tracepoint_destructors_syms
*lttng_ust_tracepoint_destructors_syms_ptr
;
339 struct lttng_ust_tracepoint_destructors_syms lttng_ust_tracepoint_destructors_syms
340 __attribute__((weak
, visibility("hidden"))) = {
341 .struct_size
= sizeof(struct lttng_ust_tracepoint_destructors_syms
),
343 struct lttng_ust_tracepoint_destructors_syms
*lttng_ust_tracepoint_destructors_syms_ptr
344 __attribute__((weak
, visibility("hidden")));
346 static inline void tracepoint_disable_destructors(void)
348 if (!lttng_ust_tracepoint_dlopen_ptr
)
349 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
350 if (!lttng_ust_tracepoint_destructors_syms_ptr
)
351 lttng_ust_tracepoint_destructors_syms_ptr
= <tng_ust_tracepoint_destructors_syms
;
352 if (lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
353 && lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_disable_destructors
)
354 lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_disable_destructors();
359 lttng_ust_tracepoint__init_urcu_sym(void)
362 lttng_ust_tracepoint__init_urcu_sym(void)
364 if (!lttng_ust_tracepoint_dlopen_ptr
)
365 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
367 * Symbols below are needed by tracepoint call sites and probe
370 if (!lttng_ust_tracepoint_dlopen_ptr
->rcu_read_lock_sym
)
371 lttng_ust_tracepoint_dlopen_ptr
->rcu_read_lock_sym
=
372 URCU_FORCE_CAST(void (*)(void),
373 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
374 "lttng_ust_tp_rcu_read_lock"));
375 if (!lttng_ust_tracepoint_dlopen_ptr
->rcu_read_unlock_sym
)
376 lttng_ust_tracepoint_dlopen_ptr
->rcu_read_unlock_sym
=
377 URCU_FORCE_CAST(void (*)(void),
378 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
379 "lttng_ust_tp_rcu_read_unlock"));
380 if (!lttng_ust_tracepoint_dlopen_ptr
->rcu_dereference_sym
)
381 lttng_ust_tracepoint_dlopen_ptr
->rcu_dereference_sym
=
382 URCU_FORCE_CAST(void *(*)(void *p
),
383 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
384 "lttng_ust_tp_rcu_dereference_sym"));
388 lttng_ust_tracepoint__init_urcu_sym(void)
391 lttng_ust_tracepoint__init_urcu_sym(void)
397 * Use getenv() directly and bypass lttng-ust helper functions
398 * because we may not have access to lttng-ust shared libraries.
400 #ifdef LTTNG_UST_DEBUG
402 bool lttng_ust_tracepoint_logging_debug_enabled(void)
406 #else /* #ifdef LTTNG_UST_DEBUG */
408 bool lttng_ust_tracepoint_logging_debug_enabled(void)
410 return getenv("LTTNG_UST_DEBUG");
412 #endif /* #ifdef LTTNG_UST_DEBUG */
414 #ifdef LTTNG_UST_ABORT_ON_CRITICAL
416 bool lttng_ust_tracepoint_logging_abort_on_critical_enabled(void)
420 #else /* #ifdef LTTNG_UST_ABORT_ON_CRITICAL */
422 bool lttng_ust_tracepoint_logging_abort_on_critical_enabled(void)
424 return getenv("LTTNG_UST_ABORT_ON_CRITICAL");
428 #define LTTNG_UST_TRACEPOINT_THIS_IP \
429 ({ __label__ here; here: &&here; })
432 lttng_ust_tracepoints_print_disabled_message(void)
434 if (lttng_ust_tracepoint_logging_debug_enabled())
435 fprintf(stderr
, "lttng-ust-tracepoint [%ld]: Critical: dlopen() failed to find '%s', tracepoints in this binary won't be registered. "
436 "(at addr=%p in %s() at " __FILE__
":" lttng_ust_stringify(__LINE__
) ")\n",
438 LTTNG_UST_TRACEPOINT_LIB_SONAME
,
439 LTTNG_UST_TRACEPOINT_THIS_IP
,
441 if (lttng_ust_tracepoint_logging_abort_on_critical_enabled())
446 lttng_ust__tracepoints__init(void)
447 lttng_ust_notrace
__attribute__((constructor(LTTNG_UST_CONSTRUCTOR_PRIO
)));
449 lttng_ust__tracepoints__init(void)
451 if (lttng_ust_tracepoint_registered
++) {
452 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
)
454 lttng_ust_tracepoint__init_urcu_sym();
458 if (!lttng_ust_tracepoint_dlopen_ptr
)
459 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
460 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
)
461 lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
=
462 dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME
, RTLD_NOW
| RTLD_GLOBAL
);
463 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
) {
464 lttng_ust_tracepoints_print_disabled_message();
467 lttng_ust_tracepoint__init_urcu_sym();
471 lttng_ust__tracepoints__destroy(void)
472 lttng_ust_notrace
__attribute__((destructor(LTTNG_UST_CONSTRUCTOR_PRIO
)));
474 lttng_ust__tracepoints__destroy(void)
478 if (--lttng_ust_tracepoint_registered
)
480 if (!lttng_ust_tracepoint_dlopen_ptr
)
481 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
482 if (!lttng_ust_tracepoint_destructors_syms_ptr
)
483 lttng_ust_tracepoint_destructors_syms_ptr
= <tng_ust_tracepoint_destructors_syms
;
484 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
)
486 if (lttng_ust_tracepoint_ptrs_registered
)
489 * Lookup if destructors must be executed using the new method.
491 if (lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_get_destructors_state
492 && !lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_get_destructors_state()) {
494 * The tracepoint_get_destructors_state symbol was found with
495 * dlsym but its returned value is 0 meaning that destructors
496 * must not be executed.
500 ret
= dlclose(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
);
502 fprintf(stderr
, "Error (%d) in dlclose\n", ret
);
505 memset(lttng_ust_tracepoint_dlopen_ptr
, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr
));
508 #if LTTNG_UST_COMPAT_API(0)
509 # if defined(TRACEPOINT_DEFINE) && !defined(LTTNG_UST_TRACEPOINT_DEFINE)
510 # define LTTNG_UST_TRACEPOINT_DEFINE
512 #endif /* #if LTTNG_UST_COMPAT_API(0) */
514 #if LTTNG_UST_COMPAT_API(0)
515 #define tracepoint lttng_ust_tracepoint
516 #define do_tracepoint lttng_ust_do_tracepoint
517 #define tracepoint_enabled lttng_ust_tracepoint_enabled
518 #define TP_ARGS LTTNG_UST_TP_ARGS
519 #endif /* #if LTTNG_UST_COMPAT_API(0) */
525 #endif /* _LTTNG_UST_TRACEPOINT_H */
527 /* The following declarations must be outside re-inclusion protection. */
529 #ifdef LTTNG_UST_TRACEPOINT_DEFINE
531 #ifndef _LTTNG_UST_TRACEPOINT_DEFINE_ONCE
532 #define _LTTNG_UST_TRACEPOINT_DEFINE_ONCE
539 * These weak symbols, the constructor, and destructor take care of
540 * registering only _one_ instance of the tracepoints per shared-ojbect
541 * (or for the whole main program).
543 extern struct lttng_ust_tracepoint
* const __start_lttng_ust_tracepoints_ptrs
[]
544 __attribute__((weak
, visibility("hidden")));
545 extern struct lttng_ust_tracepoint
* const __stop_lttng_ust_tracepoints_ptrs
[]
546 __attribute__((weak
, visibility("hidden")));
549 * When LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE is defined, we do not emit a
550 * unresolved symbol that requires the provider to be linked in. When
551 * LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE is not defined, we emit an
552 * unresolved symbol that depends on having the provider linked in,
553 * otherwise the linker complains. This deals with use of static
554 * libraries, ensuring that the linker does not remove the provider
555 * object from the executable.
558 #if LTTNG_UST_COMPAT_API(0)
559 # if defined(TRACEPOINT_PROBE_DYNAMIC_LINKAGE) && !defined(LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE)
560 # define LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE
562 #endif /* #if LTTNG_UST_COMPAT_API(0) */
564 #ifdef LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE
565 #define LTTNG_UST__TRACEPOINT_UNDEFINED_REF(provider) NULL
566 #else /* LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
567 #define LTTNG_UST__TRACEPOINT_UNDEFINED_REF(provider) <tng_ust_tracepoint_provider_##provider
568 #endif /* LTTNG_UST_TRACEPOINT_PROBE_DYNAMIC_LINKAGE */
571 * Note: to allow PIC code, we need to allow the linker to update the pointers
572 * in the lttng_ust_tracepoints_ptrs section.
573 * Therefore, this section is _not_ const (read-only).
575 #define LTTNG_UST__TP_EXTRACT_STRING(...) #__VA_ARGS__
577 #undef LTTNG_UST__DEFINE_TRACEPOINT
578 #define LTTNG_UST__DEFINE_TRACEPOINT(_provider, _name, _args) \
579 lttng_ust_tracepoint_validate_name_len(_provider, _name); \
580 extern int lttng_ust_tracepoint_provider_##_provider \
581 LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY; \
582 static const char lttng_ust_tp_provider_strtab_##_provider##___##_name[] \
583 __attribute__((section("lttng_ust_tracepoints_strings"))) = \
585 static const char lttng_ust_tp_name_strtab_##_provider##___##_name[] \
586 __attribute__((section("lttng_ust_tracepoints_strings"))) = \
588 struct lttng_ust_tracepoint lttng_ust_tracepoint_##_provider##___##_name \
589 __attribute__((section("lttng_ust_tracepoints"))) \
590 LTTNG_UST__TRACEPOINT_DEFINITION_VISIBILITY = { \
591 sizeof(struct lttng_ust_tracepoint), \
592 lttng_ust_tp_provider_strtab_##_provider##___##_name, \
593 lttng_ust_tp_name_strtab_##_provider##___##_name, \
596 LTTNG_UST__TRACEPOINT_UNDEFINED_REF(_provider), \
597 LTTNG_UST__TP_EXTRACT_STRING(_args), \
599 static struct lttng_ust_tracepoint * \
600 lttng_ust_tracepoint_ptr_##_provider##___##_name \
601 __attribute__((section("lttng_ust_tracepoints_ptrs"), used)) \
602 __lttng_ust_variable_attribute_no_sanitize_address = \
603 <tng_ust_tracepoint_##_provider##___##_name;
606 lttng_ust__tracepoints__ptrs_init(void)
607 lttng_ust_notrace
__attribute__((constructor(LTTNG_UST_CONSTRUCTOR_PRIO
)));
609 lttng_ust__tracepoints__ptrs_init(void)
611 if (lttng_ust_tracepoint_ptrs_registered
++)
613 if (!lttng_ust_tracepoint_dlopen_ptr
)
614 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
615 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
)
616 lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
=
617 dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME
, RTLD_NOW
| RTLD_GLOBAL
);
618 if (!lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
) {
619 lttng_ust_tracepoints_print_disabled_message();
622 if (!lttng_ust_tracepoint_destructors_syms_ptr
)
623 lttng_ust_tracepoint_destructors_syms_ptr
= <tng_ust_tracepoint_destructors_syms
;
624 lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_register
=
625 URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint
* const *, int),
626 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
627 "lttng_ust_tracepoint_module_register"));
628 lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_unregister
=
629 URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint
* const *),
630 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
631 "lttng_ust_tracepoint_module_unregister"));
632 lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_disable_destructors
=
633 URCU_FORCE_CAST(void (*)(void),
634 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
635 "lttng_ust_tp_disable_destructors"));
636 lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_get_destructors_state
=
637 URCU_FORCE_CAST(int (*)(void),
638 dlsym(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
,
639 "lttng_ust_tp_get_destructors_state"));
640 lttng_ust_tracepoint__init_urcu_sym();
641 if (lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_register
) {
642 lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_register(__start_lttng_ust_tracepoints_ptrs
,
643 __stop_lttng_ust_tracepoints_ptrs
-
644 __start_lttng_ust_tracepoints_ptrs
);
649 lttng_ust__tracepoints__ptrs_destroy(void)
650 lttng_ust_notrace
__attribute__((destructor(LTTNG_UST_CONSTRUCTOR_PRIO
)));
652 lttng_ust__tracepoints__ptrs_destroy(void)
656 if (--lttng_ust_tracepoint_ptrs_registered
)
658 if (!lttng_ust_tracepoint_dlopen_ptr
)
659 lttng_ust_tracepoint_dlopen_ptr
= <tng_ust_tracepoint_dlopen
;
660 if (!lttng_ust_tracepoint_destructors_syms_ptr
)
661 lttng_ust_tracepoint_destructors_syms_ptr
= <tng_ust_tracepoint_destructors_syms
;
662 if (lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_unregister
)
663 lttng_ust_tracepoint_dlopen_ptr
->lttng_ust_tracepoint_module_unregister(__start_lttng_ust_tracepoints_ptrs
);
664 if (lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
665 && lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_get_destructors_state
666 && lttng_ust_tracepoint_destructors_syms_ptr
->tracepoint_get_destructors_state()
667 && !lttng_ust_tracepoint_ptrs_registered
) {
668 ret
= dlclose(lttng_ust_tracepoint_dlopen_ptr
->liblttngust_handle
);
670 fprintf(stderr
, "Error (%d) in dlclose\n", ret
);
673 memset(lttng_ust_tracepoint_dlopen_ptr
, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr
));
681 #endif /* _LTTNG_UST_TRACEPOINT_DEFINE_ONCE */
683 #else /* LTTNG_UST_TRACEPOINT_DEFINE */
685 #undef LTTNG_UST__DEFINE_TRACEPOINT
686 #define LTTNG_UST__DEFINE_TRACEPOINT(_provider, _name, _args)
688 #endif /* #else LTTNG_UST_TRACEPOINT_DEFINE */
691 * LTTNG_UST_TRACEPOINT_HIDDEN_DEFINITION: Define this before including
692 * a tracepoint instrumentation header to hide symbols associated with
693 * tracepoint module instrumentation. This is useful if all compile
694 * units using the lttng_ust_tracepoint(),
695 * lttng_ust_tracepoint_enabled() and lttng_ust_do_tracepoint() macros
696 * is within the same module as the compile unit including the
697 * tracepoint header after defining LTTNG_UST_TRACEPOINT_DEFINE.
700 #undef LTTNG_UST__TRACEPOINT_DEFINITION_VISIBILITY
701 #ifdef LTTNG_UST_TRACEPOINT_HIDDEN_DEFINITION
702 #define LTTNG_UST__TRACEPOINT_DEFINITION_VISIBILITY __attribute__((visibility("hidden")))
704 #define LTTNG_UST__TRACEPOINT_DEFINITION_VISIBILITY __attribute__((visibility("default")))
708 * LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION: Define this before
709 * including a tracepoint instrumentation header to hide symbols
710 * associated with the tracepoint provider. This is useful if the
711 * tracepoint definition (including the header after defining
712 * LTTNG_UST_TRACEPOINT_DEFINE) is in the same module as the provider
713 * (including the header after defining
714 * LTTNG_UST_TRACEPOINT_CREATE_PROBES).
716 #undef LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY
717 #ifdef LTTNG_UST_TRACEPOINT_PROVIDER_HIDDEN_DEFINITION
718 #define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("hidden")))
720 #define LTTNG_UST__TRACEPOINT_PROVIDER_DEFINITION_VISIBILITY __attribute__((visibility("default")))
723 #ifndef LTTNG_UST_TRACEPOINT_ENUM
726 * Tracepoint Enumerations
728 * The enumeration is a mapping between an integer, or range of integers, and
729 * a string. It can be used to have a more compact trace in cases where the
730 * possible values for a field are limited:
734 * LTTNG_UST_TRACEPOINT_ENUM(someproject_component, enumname,
735 * LTTNG_UST_TP_ENUM_VALUES(
736 * lttng_ust_field_enum_value("even", 0)
737 * lttng_ust_field_enum_value("uneven", 1)
738 * lttng_ust_field_enum_range("twoto4", 2, 4)
739 * lttng_ust_field_enum_value("five", 5)
743 * Where "someproject_component" is the name of the component this enumeration
744 * belongs to and "enumname" identifies this enumeration. Inside the
745 * LTTNG_UST_TP_ENUM_VALUES macro is the actual mapping. Each string value can map
746 * to either a single value with lttng_ust_field_enum_value or a range of values
747 * with lttng_ust_field_enum_range.
749 * Enumeration ranges may overlap, but the behavior is implementation-defined,
750 * each trace reader will handle overlapping as it wishes.
752 * That enumeration can then be used in a field inside the TP_FIELD macro using
753 * the following line:
755 * lttng_ust_field_enum(someproject_component, enumname, enumtype, enumfield, enumval)
757 * Where "someproject_component" and "enumname" match those in the
758 * LTTNG_UST_TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type
759 * backing the enumeration, "enumfield" is the name of the field and
760 * "enumval" is the value.
763 #define LTTNG_UST_TRACEPOINT_ENUM(provider, name, values)
765 #if LTTNG_UST_COMPAT_API(0)
766 #define TRACEPOINT_ENUM LTTNG_UST_TRACEPOINT_ENUM
767 #endif /* #if LTTNG_UST_COMPAT_API(0) */
769 #endif /* #ifndef LTTNG_UST_TRACEPOINT_ENUM */
771 #ifndef LTTNG_UST_TRACEPOINT_EVENT
774 * How to use the LTTNG_UST_TRACEPOINT_EVENT macro:
778 * LTTNG_UST_TRACEPOINT_EVENT(someproject_component, event_name,
780 * * LTTNG_UST_TP_ARGS takes from 0 to 10 "type, field_name" pairs *
782 * LTTNG_UST_TP_ARGS(int, arg0, void *, arg1, char *, string, size_t, strlen,
783 * long *, arg4, size_t, arg4_len),
785 * * LTTNG_UST_TP_FIELDS describes the event payload layout in the trace *
787 * LTTNG_UST_TP_FIELDS(
788 * * Integer, printed in base 10 *
789 * lttng_ust_field_integer(int, field_a, arg0)
791 * * Integer, printed with 0x base 16 *
792 * lttng_ust_field_integer_hex(unsigned long, field_d, arg1)
795 * lttng_ust_field_enum(someproject_component, enum_name, int, field_e, arg0)
797 * * Array Sequence, printed as UTF8-encoded array of bytes *
798 * lttng_ust_field_array_text(char, field_b, string, FIXED_LEN)
799 * lttng_ust_field_sequence_text(char, field_c, string, size_t, strlen)
801 * * String, printed as UTF8-encoded string *
802 * lttng_ust_field_string(field_e, string)
804 * * Array sequence of signed integer values *
805 * lttng_ust_field_array(long, field_f, arg4, FIXED_LEN4)
806 * lttng_ust_field_sequence(long, field_g, arg4, size_t, arg4_len)
810 * More detailed explanation:
812 * The name of the tracepoint is expressed as a tuple with the provider
813 * and name arguments.
815 * The provider and name should be a proper C99 identifier.
816 * The "provider" and "name" MUST follow these rules to ensure no
817 * namespace clash occurs:
819 * For projects (applications and libraries) for which an entity
820 * specific to the project controls the source code and thus its
821 * tracepoints (typically with a scope larger than a single company):
824 * project_component, event
828 * Where "project" is the name of the project,
829 * "component" is the name of the project component (which may
830 * include several levels of sub-components, e.g.
831 * ...component_subcomponent_...) where the tracepoint is located
833 * "event" is the name of the tracepoint event.
835 * For projects issued from a single company wishing to advertise that
836 * the company controls the source code and thus the tracepoints, the
837 * "com_" prefix should be used:
840 * com_company_project_component, event
842 * com_company_project, event
844 * Where "company" is the name of the company,
845 * "project" is the name of the project,
846 * "component" is the name of the project component (which may
847 * include several levels of sub-components, e.g.
848 * ...component_subcomponent_...) where the tracepoint is located
850 * "event" is the name of the tracepoint event.
852 * the provider:event identifier is limited to 127 characters.
855 #define LTTNG_UST_TRACEPOINT_EVENT(provider, name, args, fields) \
856 LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \
857 LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args))
859 #define LTTNG_UST_TRACEPOINT_EVENT_CLASS(provider, name, args, fields)
861 #define LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(template_provider, template_name, provider, name, args) \
862 LTTNG_UST__DECLARE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args)) \
863 LTTNG_UST__DEFINE_TRACEPOINT(provider, name, LTTNG_UST__TP_PARAMS(args))
865 #if LTTNG_UST_COMPAT_API(0)
866 #define TRACEPOINT_EVENT LTTNG_UST_TRACEPOINT_EVENT
867 #define TRACEPOINT_EVENT_CLASS LTTNG_UST_TRACEPOINT_EVENT_CLASS
868 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, args) \
869 LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(_provider, _template, \
870 _provider, _name, LTTNG_UST__TP_PARAMS(args))
872 #endif /* #if LTTNG_UST_COMPAT_API(0) */
874 #endif /* #ifndef LTTNG_UST_TRACEPOINT_EVENT */
876 #ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL
879 * Tracepoint Loglevels
881 * Typical use of these loglevels:
883 * The loglevels go from 0 to 14. Higher numbers imply the most
884 * verbosity (higher event throughput expected.
886 * Loglevels 0 through 6, and loglevel 14, match syslog(3) loglevels
887 * semantic. Loglevels 7 through 13 offer more fine-grained selection of
890 * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG 0
893 * LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT 1
894 * action must be taken immediately
896 * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT 2
897 * critical conditions
899 * LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR 3
902 * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING 4
905 * LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE 5
906 * normal, but significant, condition
908 * LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO 6
909 * informational message
911 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM 7
912 * debug information with system-level scope (set of programs)
914 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM 8
915 * debug information with program-level scope (set of processes)
917 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS 9
918 * debug information with process-level scope (set of modules)
920 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE 10
921 * debug information with module (executable/library) scope (set of units)
923 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT 11
924 * debug information with compilation unit scope (set of functions)
926 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION 12
927 * debug information with function-level scope
929 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE 13
930 * debug information with line-level scope (LTTNG_UST_TRACEPOINT_EVENT default)
932 * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG 14
933 * debug-level message
935 * Declare tracepoint loglevels for tracepoints. A LTTNG_UST_TRACEPOINT_EVENT
936 * should be declared prior to the the LTTNG_UST_TRACEPOINT_LOGLEVEL for a given
937 * tracepoint name. The first field is the provider name, the second
938 * field is the name of the tracepoint, the third field is the loglevel
941 * LTTNG_UST_TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >,
944 * The LTTNG_UST_TRACEPOINT_PROVIDER must be already declared before declaring a
945 * LTTNG_UST_TRACEPOINT_LOGLEVEL.
949 LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG
= 0,
950 LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT
= 1,
951 LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT
= 2,
952 LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR
= 3,
953 LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING
= 4,
954 LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE
= 5,
955 LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO
= 6,
956 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM
= 7,
957 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM
= 8,
958 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS
= 9,
959 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE
= 10,
960 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT
= 11,
961 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION
= 12,
962 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE
= 13,
963 LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG
= 14,
966 #define LTTNG_UST_TRACEPOINT_LOGLEVEL(provider, name, loglevel)
968 #if LTTNG_UST_COMPAT_API(0)
969 #define TRACEPOINT_LOGLEVEL LTTNG_UST_TRACEPOINT_LOGLEVEL
971 #define TRACE_EMERG LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG
972 #define TRACE_ALERT LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT
973 #define TRACE_CRIT LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT
974 #define TRACE_ERR LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR
975 #define TRACE_WARNING LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING
976 #define TRACE_NOTICE LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE
977 #define TRACE_INFO LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO
978 #define TRACE_DEBUG_SYSTEM LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM
979 #define TRACE_DEBUG_PROGRAM LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM
980 #define TRACE_DEBUG_PROCESS LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS
981 #define TRACE_DEBUG_MODULE LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE
982 #define TRACE_DEBUG_UNIT LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT
983 #define TRACE_DEBUG_FUNCTION LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION
984 #define TRACE_DEBUG_LINE LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE
985 #define TRACE_DEBUG LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG
988 #endif /* #ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL */
990 #ifndef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
992 #define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(provider, name, uri)
994 #if LTTNG_UST_COMPAT_API(0)
995 #define TRACEPOINT_MODEL_EMF_URI LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
998 #endif /* #ifndef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI */