@ -34,6 +34,7 @@
# define TRACE_WITH_PERFETTO 1
# define TRACE_WITH_STDERR 2
# define TRACE_WITH_PERCETTO 3
# define BIT(n) (UINT32_C(1) << (n))
@ -63,20 +64,42 @@ void flush_eventfd(int fd);
# ifdef ENABLE_TRACING
void trace_init ( void ) ;
const char * trace_begin ( const char * scope ) ;
void trace_end ( const char * * dummy ) ;
# define TRACE_INIT() trace_init()
# define TRACE_FUNC() TRACE_SCOPE(__func__)
# if ENABLE_TRACING == TRACE_WITH_PERCETTO
# include <percetto.h>
# define VIRGL_PERCETTO_CATEGORIES(C, G) \
C ( virgl , " virglrenderer " ) \
C ( virgls , " virglrenderer detailed events " , " slow " )
PERCETTO_CATEGORY_DECLARE ( VIRGL_PERCETTO_CATEGORIES )
# define TRACE_SCOPE(SCOPE) TRACE_EVENT(virgl, SCOPE)
/* Trace high frequency events (tracing may impact performance). */
# define TRACE_SCOPE_SLOW(SCOPE) TRACE_EVENT(virgls, SCOPE)
# else
const char * trace_begin ( const char * scope ) ;
void trace_end ( const char * * scope ) ;
# define TRACE_SCOPE(SCOPE) \
const char * trace_dummy __attribute__ ( ( cleanup ( trace_end ) , unused ) ) = \
trace_begin ( SCOPE )
# define TRACE_SCOPE_SLOW(SCOPE) TRACE_SCOPE(SCOPE)
# endif /* ENABLE_TRACING == TRACE_WITH_PERCETTO */
# else
# define TRACE_INIT()
# define TRACE_FUNC()
# define TRACE_SCOPE(SCOPE)
# endif
# define TRACE_SCOPE_SLOW(SCOPE)
# endif /* ENABLE_TRACING */
# endif /* VIRGL_UTIL_H */