From f8a9ebce97c3e4a5301569cd91d691db8de8ed91 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Fri, 5 Mar 2021 10:20:57 +0100 Subject: [PATCH] tracing: Add macros to emit begin and end markers seperately This is useful when one wants to trace events like frame begin and end Signed-off-by: Gert Wollny Reviewed-by: Rohan Garg --- src/virgl_util.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/virgl_util.h b/src/virgl_util.h index 951410e..cd02fa9 100644 --- a/src/virgl_util.h +++ b/src/virgl_util.h @@ -82,6 +82,9 @@ PERCETTO_CATEGORY_DECLARE(VIRGL_PERCETTO_CATEGORIES) /* Trace high frequency events (tracing may impact performance). */ #define TRACE_SCOPE_SLOW(SCOPE) TRACE_EVENT(virgls, SCOPE) +#define TRACE_SCOPE_BEGIN(SCOPE) TRACE_EVENT_BEGIN(virgl, SCOPE) +#define TRACE_SCOPE_END(SCOPE) do { TRACE_EVENT_END(virgl); (void)SCOPE; } while (0) + #else const char *trace_begin(const char *scope); @@ -93,6 +96,9 @@ void trace_end(const char **scope); #define TRACE_SCOPE_SLOW(SCOPE) TRACE_SCOPE(SCOPE) +#define TRACE_SCOPE_BEGIN(SCOPE) trace_begin(SCOPE); +#define TRACE_SCOPE_END(SCOPE) trace_end(&SCOPE); + #endif /* ENABLE_TRACING == TRACE_WITH_PERCETTO */ #else @@ -100,6 +106,8 @@ void trace_end(const char **scope); #define TRACE_FUNC() #define TRACE_SCOPE(SCOPE) #define TRACE_SCOPE_SLOW(SCOPE) +#define TRACE_SCOPE_BEGIN(SCOPE, VAR) +#define TRACE_SCOPE_END(VAR) #endif /* ENABLE_TRACING */ #endif /* VIRGL_UTIL_H */