···113113 target_link_libraries(aux_util PUBLIC percetto::percetto)
114114endif()
115115116116+# Is basically used everywhere, only used in debugging.
117117+if(XRT_FEATURE_TRACING AND XRT_HAVE_TRACY)
118118+ target_link_libraries(aux_util PUBLIC xrt-external-tracy)
119119+endif()
120120+116121# Is basically used everywhere, so link with here.
117122if(ANDROID)
118123 target_link_libraries(aux_util PUBLIC ${ANDROID_LOG_LIBRARY})
+91-2
src/xrt/auxiliary/util/u_trace_marker.h
···3030#include <percetto.h>
3131#endif
32323333+#if defined(XRT_FEATURE_TRACING) && defined(XRT_HAVE_TRACY)
3434+#define U_TRACE_TRACY
3535+#include "tracy/TracyC.h"
3636+#ifdef __cplusplus
3737+#include "tracy/Tracy.hpp"
3838+#endif
3939+#endif
4040+33413442#ifdef __cplusplus
3543extern "C" {
···130138131139/*
132140 *
141141+ * Tracy support.
142142+ *
143143+ */
144144+145145+#elif defined(XRT_HAVE_TRACY) // && XRT_FEATURE_TRACING
146146+147147+// Different wrappers for different cases.
148148+#ifdef __cplusplus
149149+150150+#define U_TRACE_FUNC(CATEGORY) ZoneScoped
151151+152152+#define U_TRACE_IDENT(CATEGORY, IDENT) ZoneScopedN(#IDENT)
153153+154154+#elif !defined(XRT_OS_WINDOWS) // !__cplusplus
155155+156156+static inline void
157157+u_trace_scope_cleanup(TracyCZoneCtx *ctx_ptr)
158158+{
159159+ TracyCZoneEnd(*ctx_ptr);
160160+}
161161+162162+#define U_TRACE_FUNC(CATEGORY) \
163163+ static const struct ___tracy_source_location_data __func_loc = { \
164164+ NULL, __func__, __FILE__, (uint32_t)__LINE__, 0, \
165165+ }; \
166166+ TracyCZoneCtx __attribute__((cleanup(u_trace_scope_cleanup))) ctx = \
167167+ ___tracy_emit_zone_begin(&__func_loc, true); \
168168+ (void)ctx
169169+170170+#define U_TRACE_IDENT(CATEGORY, IDENT) \
171171+ static const struct ___tracy_source_location_data __##IDENT##_loc = { \
172172+ #IDENT, __func__, __FILE__, (uint32_t)__LINE__, 0, \
173173+ }; \
174174+ TracyCZoneCtx __attribute__((cleanup(u_trace_scope_cleanup))) ctx##IDENT = \
175175+ ___tracy_emit_zone_begin(&__##IDENT##_loc, true); \
176176+ (void)ctx##IDENT
177177+178178+#else // !XRT_OS_WINDOWS && !__cplusplus
179179+180180+#define U_TRACE_FUNC(CATEGORY) \
181181+ do { \
182182+ } while (false)
183183+184184+#define U_TRACE_IDENT(CATEGORY, IDENT) \
185185+ do { \
186186+ } while (false)
187187+188188+#endif // !XRT_OS_WINDOWS && !__cplusplus
189189+190190+191191+#define U_TRACE_EVENT_BEGIN_ON_TRACK(CATEGORY, TRACK, TIME, NAME) \
192192+ do { \
193193+ } while (false)
194194+195195+#define U_TRACE_EVENT_BEGIN_ON_TRACK_DATA(CATEGORY, TRACK, TIME, NAME, ...) \
196196+ do { \
197197+ } while (false)
198198+199199+#define U_TRACE_EVENT_END_ON_TRACK(CATEGORY, TRACK, TIME) \
200200+ do { \
201201+ } while (false)
202202+203203+#define U_TRACE_INSTANT_ON_TRACK(CATEGORY, TRACK, TIME, NAME) \
204204+ do { \
205205+ } while (false)
206206+207207+#define U_TRACE_CATEGORY_IS_ENABLED(_) (true) // All categories are always enabled with Tracy.
208208+209209+#define U_TRACE_SET_THREAD_NAME(STRING) \
210210+ do { \
211211+ /* To help with thread ordering and seeing when a thread is created. */ \
212212+ TracyCZoneN(created, "created", true); \
213213+ TracyCSetThreadName(STRING); \
214214+ TracyCZoneEnd(created); \
215215+ } while (false)
216216+217217+#define U_TRACE_TARGET_SETUP(WHICH)
218218+219219+220220+/*
221221+ *
133222 * Percetto support.
134223 *
135224 */
136225137137-#elif defined(XRT_HAVE_PERCETTO) // && XRT_FEATURE_TRACKING
226226+#elif defined(XRT_HAVE_PERCETTO) // && XRT_FEATURE_TRACKING && !XRT_HAVE_TRACY
138227139228#ifndef XRT_OS_LINUX
140229#error "Tracing only supported on Linux"
···190279 u_trace_marker_setup(WHICH); \
191280 }
192281193193-#else // !XRT_FEATURE_TRACING && !XRT_HAVE_PERCETTO
282282+#else // !XRT_FEATURE_TRACING && !XRT_HAVE_PERCETTO && !XRT_HAVE_TRACY
194283195284#error "Need to have Percetto/Perfetto"
196285