inline void
trace_framebuffer_state(struct u_trace *ut, void *cs, const struct pipe_framebuffer_state *pfb)
{
- if (likely(!(ut_trace_instrument || ut_perfetto_enabled)))
+ if (likely(!u_trace_instrument()))
return;
trace_framebuffer(ut, cs, pfb);
#define TIMESTAMP_BUF_SIZE 0x1000
#define TRACES_PER_CHUNK (TIMESTAMP_BUF_SIZE / sizeof(uint64_t))
-bool ut_trace_instrument;
+bool _u_trace_instrument;
#ifdef HAVE_PERFETTO
int ut_perfetto_enabled;
tracefile = stdout;
}
- ut_trace_instrument = tracefile || debug_get_option_trace_instrument();
+ _u_trace_instrument = tracefile || debug_get_option_trace_instrument();
firsttime = false;
}
*/
void u_trace_flush(struct u_trace *ut, void *flush_data, bool free_data);
-/**
- * Whether command buffers should be instrumented even if not collecting
- * traces.
- */
-extern bool ut_trace_instrument;
-
#ifdef HAVE_PERFETTO
extern int ut_perfetto_enabled;
# define ut_perfetto_enabled 0
#endif
+/**
+ * Return whether instrumentations should be enabled or not. This is called
+ * from tracepoints.
+ */
+static inline bool
+u_trace_instrument(void)
+{
+ extern bool _u_trace_instrument;
+ return _u_trace_instrument || ut_perfetto_enabled;
+}
+
static inline bool
u_trace_context_actively_tracing(struct u_trace_context *utctx)
{
, ${arg.type} ${arg.var}
% endfor
) {
-% if trace.tp_perfetto is not None:
- if (!unlikely((ut_trace_instrument || ut_perfetto_enabled) &&
- ${trace.enabled_expr(trace_toggle_name)}))
-% else:
- if (!unlikely(ut_trace_instrument &&
+ if (!unlikely(u_trace_instrument() &&
${trace.enabled_expr(trace_toggle_name)}))
-% endif
return;
__trace_${trace_name}(
ut