mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 05:30:31 +01:00
util/perf: add u_trace_instrument
It is called from tracepoints. When it returns false, instrumentation is disabled. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18309>
This commit is contained in:
parent
aeb2c5a8da
commit
18d7cb4abb
4 changed files with 15 additions and 15 deletions
|
|
@ -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_trace_instrument || ut_perfetto_enabled)))
|
||||
if (likely(!u_trace_instrument()))
|
||||
return;
|
||||
|
||||
trace_framebuffer(ut, cs, pfb);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
#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;
|
||||
|
|
@ -369,7 +369,7 @@ get_tracefile(void)
|
|||
tracefile = stdout;
|
||||
}
|
||||
|
||||
ut_trace_instrument = tracefile || debug_get_option_trace_instrument();
|
||||
_u_trace_instrument = tracefile || debug_get_option_trace_instrument();
|
||||
|
||||
firsttime = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,12 +270,6 @@ void u_trace_disable_event_range(struct u_trace_iterator begin_it,
|
|||
*/
|
||||
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;
|
||||
|
||||
|
|
@ -285,6 +279,17 @@ void u_trace_perfetto_stop(void);
|
|||
# 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -252,13 +252,8 @@ static inline void trace_${trace_name}(
|
|||
, ${arg.type} ${arg.var}
|
||||
% endfor
|
||||
) {
|
||||
% if trace.tp_perfetto is not None:
|
||||
if (!unlikely((ut_trace_instrument || ut_perfetto_enabled) &&
|
||||
if (!unlikely(u_trace_instrument() &&
|
||||
${trace.enabled_expr(trace_toggle_name)}))
|
||||
% else:
|
||||
if (!unlikely(ut_trace_instrument &&
|
||||
${trace.enabled_expr(trace_toggle_name)}))
|
||||
% endif
|
||||
return;
|
||||
__trace_${trace_name}(
|
||||
ut
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue