Lines Matching +full:user +full:- +full:defined
1 // SPDX-License-Identifier: BSD-2-Clause
3 * This single-header library defines a collection of variadic macros for
4 * defining and triggering USDTs (User Statically-Defined Tracepoints):
6 * - For USDTs without associated semaphore:
9 * - For USDTs with implicit (transparent to the user) semaphore:
13 * - For USDTs with explicit (user-defined and provided) semaphore:
22 * USDTs can have an associated (2-byte) activity counter (USDT semaphore),
24 * BPF-based tracer is attached to the USDT. This USDT semaphore can be used
38 * Tracing tools (bpftrace and BPF-based tracers, systemtap, etc) insert
39 * breakpoints on top of the nop, and decode the location operand-strings,
43 * They are constrained by inline-assembler codes.The default is:
58 * library and generally recognized and assumed by BPF-based tracing tools)
64 * terms of exposed user API and general usability, which was the main goal
66 * USDT definitions are fully binary compatible and any USDT-based tooling
67 * should work equally well with USDTs defined by either SystemTap's or this
70 * [0] https://ecos.sourceware.org/ml/systemtap/2010-q3/msg00145.html
82 * -----
83 * - Initial release
89 /* C++20 and C23 added __VA_OPT__ as a standard replacement for non-standard `##__VA_ARGS__` extens…
90 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L) || (defined(__cplusplus) && __cpluspl…
119 * implicitly-defined associated USDT semaphore, which will be "activated" by
139 * N.B. Implicit USDT semaphore defined by USDT_WITH_SEMA() is contained
183 * case should result in one-time wasted extra data collection and processing.
193 * APIs for working with user-defined explicit USDT semaphores.
195 * This is a less commonly used advanced API for use cases in which user needs
201 * semaphore defined with USDT_DEFINE_SEMA() and the USDTs themselves will be
207 * Underlying C global variable name for user-defined USDT semaphore with
214 * Define storage for user-defined USDT semaphore `sema`.
216 * Should be used only once in non-header source file to let compiler allocate
221 * one definition of user-defined USDT semaphore with given `sema` identifier,
228 * referenced, or any of its parent namespaces, so the C++ language-level
234 * no-brainer solution. All these aspects are irrelevant for plain C, because
237 * N.B. Due to USDT metadata being recorded in non-allocatable ELF note
242 * library or executable to avoid unpleasant surprises with half-working USDT
253 * Declare extern reference to user-defined USDT semaphore `sema`.
255 * Refers to a variable defined in another compilation unit by
265 * Check if user-defined USDT semaphore `sema` is "active" (i.e., whether it
275 * in one-time missed USDT event or wasted extra data collection and
276 * processing. USDT-using tracers should be written with this in mind and is
283 * explicitly user-defined semaphore `sema` with it. Pass through `args` as
286 * Semaphore is defined with the help of USDT_DEFINE_SEMA() macro and can be
301 #if defined __powerpc__
303 #elif defined __arm__
305 #elif defined __loongarch__
313 #if defined(__ia64__) || defined(__s390__) || defined(__s390x__)
323 /* USDT name for implicitly-defined USDT semaphore, derived from group:name */
382 /* implicitly defined __usdt_sema__group__name semaphore (using weak symbols) */
400 /* externally defined semaphore using USDT_DEFINE_SEMA() and passed explicitly by user */
413 __usdt_asm3( .4byte 992f-991f,994f-993f,3) \
444 * i386, 64-bit value may be put in register pairs, and a register
446 * asked to emit the %w[id] (16-bit alias of some registers holding
447 * operands), even when a wider 32-bit value was used.
449 * Bottom line: the byte-width given before the @ sign governs. If
452 * architecture-specific heuristics to figure out where the compiler
455 #if defined(__powerpc__) || defined(__powerpc64__)
457 #elif defined(__i386__)
486 * We can't use __builtin_choose_expr() in C++, so fall back to table-based
505 template<> struct __usdt_t<T> { static const bool is_signed = (T)-1 < (T)1; }; \
506 template<> struct __usdt_t<const T> { static const bool is_signed = (T)-1 < (T)1; }; \
507 template<> struct __usdt_t<volatile T> { static const bool is_signed = (T)-1 < (T)1; }; \
508 template<> struct __usdt_t<const volatile T> { static const bool is_signed = (T)-1 < (T)1; }
522 #define __usdt_is_signed(x) ((__usdt_inttype(x))-1 < (__usdt_inttype(x))1)
527 [__usdt_asz##n] "n" ((__usdt_is_signed(x) ? (int)-1 : 1) * (int)__usdt_arg_size(x)), \