util/perf: remove u_trace::enabled

We can set ut_trace_instrument when either GPU_TRACE or
GPU_TRACE_INSTRUMENT is set.  This results in one less variable to check
in tracepoints.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
This commit is contained in:
Chia-I Wu 2022-08-29 16:46:57 -07:00 committed by Marge Bot
parent 8d8d4347e3
commit aeb2c5a8da
4 changed files with 4 additions and 13 deletions

View file

@ -76,7 +76,7 @@ u_trace_pipe_context_init(struct u_trace_context *utctx,
inline void
trace_framebuffer_state(struct u_trace *ut, void *cs, const struct pipe_framebuffer_state *pfb)
{
if (likely(!ut->enabled))
if (likely(!(ut_trace_instrument || ut_perfetto_enabled)))
return;
trace_framebuffer(ut, cs, pfb);

View file

@ -369,7 +369,7 @@ get_tracefile(void)
tracefile = stdout;
}
ut_trace_instrument = debug_get_option_trace_instrument();
ut_trace_instrument = tracefile || debug_get_option_trace_instrument();
firsttime = false;
}
@ -595,7 +595,6 @@ u_trace_init(struct u_trace *ut, struct u_trace_context *utctx)
{
ut->utctx = utctx;
list_inithead(&ut->trace_chunks);
ut->enabled = u_trace_context_instrumenting(utctx);
}
void

View file

@ -187,8 +187,6 @@ struct u_trace {
struct u_trace_context *utctx;
struct list_head trace_chunks; /* list of unflushed trace chunks in fifo order */
bool enabled;
};
void u_trace_context_init(struct u_trace_context *utctx,
@ -293,12 +291,6 @@ u_trace_context_actively_tracing(struct u_trace_context *utctx)
return !!utctx->out || (ut_perfetto_enabled > 0);
}
static inline bool
u_trace_context_instrumenting(struct u_trace_context *utctx)
{
return !!utctx->out || ut_trace_instrument || (ut_perfetto_enabled > 0);
}
#ifdef __cplusplus
}
#endif

View file

@ -253,10 +253,10 @@ static inline void trace_${trace_name}(
% endfor
) {
% if trace.tp_perfetto is not None:
if (!unlikely((ut->enabled || ut_trace_instrument || ut_perfetto_enabled) &&
if (!unlikely((ut_trace_instrument || ut_perfetto_enabled) &&
${trace.enabled_expr(trace_toggle_name)}))
% else:
if (!unlikely((ut->enabled || ut_trace_instrument) &&
if (!unlikely(ut_trace_instrument &&
${trace.enabled_expr(trace_toggle_name)}))
% endif
return;