trace: Have annotation functions return a count

This is a step towards annotating larger structs.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2026-05-05 12:48:52 -05:00
parent a285379c9a
commit c56f2bc709
3 changed files with 14 additions and 9 deletions

View file

@ -227,7 +227,7 @@ util_perfetto_trace_commit_annotate_func_flow(uint64_t id, const char *name,
});
}
void
int
perfetto_annotate_int(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,
@ -236,9 +236,11 @@ perfetto_annotate_int(struct weston_debug_annotation *annots,
annots[count].type = WESTON_DEBUG_ANNOTATION_INT_VAL;
annots[count].ivalue = value;
annots[count].key = key;
return 1;
}
void
int
perfetto_annotate_float(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,
@ -247,9 +249,11 @@ perfetto_annotate_float(struct weston_debug_annotation *annots,
annots[count].type = WESTON_DEBUG_ANNOTATION_FLOAT_VAL;
annots[count].fvalue = value;
annots[count].key = key;
return 1;
}
void
int
perfetto_annotate_string(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,
@ -258,6 +262,8 @@ perfetto_annotate_string(struct weston_debug_annotation *annots,
annots[count].type = WESTON_DEBUG_ANNOTATION_STR_VAL;
annots[count].svalue = value;
annots[count].key = key;
return 1;
}
class UtilPerfettoObserver : public perfetto::TrackEventSessionObserver {

View file

@ -92,19 +92,19 @@ uint64_t util_perfetto_next_id(void);
uint64_t util_perfetto_new_track(const char *name);
void
int
perfetto_annotate_int(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,
int value);
void
int
perfetto_annotate_float(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,
float value);
void
int
perfetto_annotate_string(struct weston_debug_annotation *annots,
unsigned int count,
const char *key,

View file

@ -79,14 +79,13 @@
#define _WESTON_TRACE_DO_ANNOTATE_ADD(k, v) \
weston_assert_u32_gt(NULL, WESTON_MAX_DEBUG_ANNOTS, __pd_i); \
_Generic((v), \
__pd_i += _Generic((v), \
int: perfetto_annotate_int, \
unsigned int: perfetto_annotate_int, \
float: perfetto_annotate_float, \
char *: perfetto_annotate_string, \
const char *: perfetto_annotate_string \
) (__pd_annots, __pd_i, k, v); \
__pd_i++;
) (__pd_annots, __pd_i, k, v);
#define _WESTON_TRACE_COMMIT_ANNOTATION(id, name) \
do { \