util/u_trace: count number of tracepoints

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24744>
This commit is contained in:
Lionel Landwerlin 2023-08-29 22:59:15 +03:00 committed by Marge Bot
parent a5f58e5f85
commit 64769bc5b2
2 changed files with 7 additions and 0 deletions

View file

@ -668,6 +668,7 @@ void
u_trace_init(struct u_trace *ut, struct u_trace_context *utctx)
{
ut->utctx = utctx;
ut->num_traces = 0;
list_inithead(&ut->trace_chunks);
}
@ -678,6 +679,7 @@ u_trace_fini(struct u_trace *ut)
* have been flushed to the trace-context.
*/
free_chunks(&ut->trace_chunks);
ut->num_traces = 0;
}
bool
@ -773,6 +775,7 @@ u_trace_clone_append(struct u_trace_iterator begin_it,
}
}
into->num_traces += to_copy;
to_chunk->num_traces += to_copy;
from_idx += to_copy;
@ -843,6 +846,7 @@ u_trace_appendv(struct u_trace *ut,
.tp = tp,
.payload = payload,
};
ut->num_traces++;
return payload;
}
@ -865,4 +869,5 @@ u_trace_flush(struct u_trace *ut, void *flush_data, bool free_data)
/* transfer batch's log chunks to context: */
list_splicetail(&ut->trace_chunks, &ut->utctx->flushed_trace_chunks);
list_inithead(&ut->trace_chunks);
ut->num_traces = 0;
}

View file

@ -217,6 +217,8 @@ struct u_trace_context {
struct u_trace {
struct u_trace_context *utctx;
uint32_t num_traces;
struct list_head
trace_chunks; /* list of unflushed trace chunks in fifo order */
};