trace: Have single macros for funcs with annotations

Make both a WESTON_TRACE_ANNOTATE_FUNC_FLOW and a
WESTON_TRACE_ANNOTATE_FUNC() that do the preamble, add the annotations,
and flush it out in a single "statement".

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-05-06 08:36:57 -05:00
parent 099e4724e6
commit a8d6a3ead5
2 changed files with 9 additions and 6 deletions

View file

@ -204,10 +204,9 @@ weston_surface_attach(struct weston_surface *surface,
struct weston_buffer *old_buffer = surface->buffer_ref.buffer;
enum weston_paint_node_status pnode_changes = WESTON_PAINT_NODE_CLEAN;
WESTON_TRACE_BEGIN_ANNOTATION();
WESTON_TRACE_ANNOTATE(("surface", surface->internal_name),
("new buffer", buffer));
WESTON_TRACE_ANNOTATE_FUNC_FLOW(&surface->flow_id);
WESTON_TRACE_ANNOTATE_FUNC_FLOW(&surface->flow_id,
("surface", surface->internal_name),
("new buffer", buffer));
if (!buffer) {
if (weston_surface_is_mapped(surface)) {

View file

@ -288,10 +288,14 @@ _weston_trace_scope_end(int *scope)
#define WESTON_TRACE_COMMIT_ANNOTATION(id) \
_WESTON_TRACE_COMMIT_ANNOTATION(id, __func__)
#define WESTON_TRACE_ANNOTATE_FUNC() \
#define WESTON_TRACE_ANNOTATE_FUNC(...) \
WESTON_TRACE_BEGIN_ANNOTATION(); \
WESTON_TRACE_ANNOTATE(__VA_ARGS__); \
_WESTON_TRACE_ANNOTATE_FUNC(__func__)
#define WESTON_TRACE_ANNOTATE_FUNC_FLOW(id) \
#define WESTON_TRACE_ANNOTATE_FUNC_FLOW(id, ...) \
WESTON_TRACE_BEGIN_ANNOTATION(); \
WESTON_TRACE_ANNOTATE(__VA_ARGS__); \
_WESTON_TRACE_ANNOTATE_FUNC_FLOW(id, __func__)
/* Adds a series of annotations of the form '("key string", value)' separated