mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-22 11:18:12 +02:00
trace: Move assertions into individual annotation functions
The int, string, and float annotators will become our atoms when we start logging larger structs. The functions for complex annotations will call these many times for a single annotation. So we should assert in the int, string, and float annotators before adding there, so the big functions are implicitly checked. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
f5f6989a65
commit
b4df8bd9e5
2 changed files with 5 additions and 1 deletions
|
|
@ -23,9 +23,11 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <libweston/libweston.h>
|
||||
|
||||
#include "perfetto/annotations.h"
|
||||
#include "shared/weston-assert.h"
|
||||
#include "weston-trace.h"
|
||||
|
||||
WL_EXPORT void
|
||||
|
|
@ -33,6 +35,7 @@ perfetto_annotate_int(struct weston_debug_annotations *annots,
|
|||
const char *key,
|
||||
int value)
|
||||
{
|
||||
weston_assert_u8_gt(NULL, WESTON_MAX_DEBUG_ANNOTS, annots->count);
|
||||
struct weston_debug_annotation *annot = &annots->annots[annots->count];
|
||||
|
||||
annot->type = WESTON_DEBUG_ANNOTATION_INT_VAL;
|
||||
|
|
@ -47,6 +50,7 @@ perfetto_annotate_float(struct weston_debug_annotations *annots,
|
|||
const char *key,
|
||||
float value)
|
||||
{
|
||||
weston_assert_u8_gt(NULL, WESTON_MAX_DEBUG_ANNOTS, annots->count);
|
||||
struct weston_debug_annotation *annot = &annots->annots[annots->count];
|
||||
|
||||
annot->type = WESTON_DEBUG_ANNOTATION_FLOAT_VAL;
|
||||
|
|
@ -61,6 +65,7 @@ perfetto_annotate_string(struct weston_debug_annotations *annots,
|
|||
const char *key,
|
||||
const char *value)
|
||||
{
|
||||
weston_assert_u8_gt(NULL, WESTON_MAX_DEBUG_ANNOTS, annots->count);
|
||||
struct weston_debug_annotation *annot = &annots->annots[annots->count];
|
||||
|
||||
annot->type = WESTON_DEBUG_ANNOTATION_STR_VAL;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,6 @@
|
|||
}
|
||||
|
||||
#define _WESTON_TRACE_ANNOTATE_ADD_GENERIC(k, v) \
|
||||
weston_assert_u8_gt(NULL, WESTON_MAX_DEBUG_ANNOTS, __pd_annots.count); \
|
||||
_Generic((v), \
|
||||
int: perfetto_annotate_int, \
|
||||
unsigned int: perfetto_annotate_int, \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue