remove TRACE_SCOPE_FMT to simplify tracing API

As we transition to perfetto, there are more efficient ways
of adding metadata to traces that we can use when it is
needed.

Signed-off-by: John Bates <jbates@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
John Bates 4 years ago
parent fab5e73314
commit 0621329415
  1. 41
      src/virgl_util.c
  2. 19
      src/virgl_util.h
  3. 2
      src/vrend_decode.c

@ -126,24 +126,13 @@ void trace_init(void)
vperfetto_min_startTracing(&config);
}
char *trace_begin(const char* scope)
const char *trace_begin(const char *scope)
{
vperfetto_min_beginTrackEvent_VMM(scope);
return (void *)1;
return scope;
}
char *trace_begin_fmt(const char* format, ...)
{
char buffer[1024];
va_list args;
va_start (args, format);
vsnprintf (buffer, sizeof(buffer), format, args);
va_end (args);
vperfetto_min_beginTrackEvent_VMM(buffer);
return (void *)1;
}
void trace_end(char **dummy)
void trace_end(const char **dummy)
{
(void)dummy;
vperfetto_min_endTrackEvent_VMM();
@ -156,38 +145,22 @@ void trace_init(void)
{
}
char *trace_begin_fmt(const char* format, ...)
const char *trace_begin(const char *scope)
{
for (int i = 0; i < nesting_depth; ++i)
fprintf(stderr, " ");
fprintf(stderr, "ENTER:");
char *buffer;
va_list args;
va_start (args, format);
int size = vasprintf(&buffer, format, args);
if (size < 0)
buffer=strdup("error");
va_end (args);
fprintf(stderr, "%s\n", buffer);
fprintf(stderr, "ENTER:%s\n", scope);
nesting_depth++;
return buffer;
}
char *trace_begin(const char* scope)
{
return trace_begin_fmt("%s", scope);
return scope;
}
void trace_end(char **func_name)
void trace_end(const char **func_name)
{
--nesting_depth;
for (int i = 0; i < nesting_depth; ++i)
fprintf(stderr, " ");
fprintf(stderr, "LEAVE %s\n", *func_name);
free(*func_name);
}
#endif

@ -63,29 +63,20 @@ void flush_eventfd(int fd);
#ifdef ENABLE_TRACING
void trace_init(void);
char *trace_begin(const char* scope);
char *trace_begin_fmt(const char* format, ...);
void trace_end(char **dummy);
const char *trace_begin(const char *scope);
void trace_end(const char **dummy);
#define TRACE_INIT() trace_init()
#define TRACE_FUNC() \
char *trace_dummy __attribute__((cleanup (trace_end), unused)) = \
trace_begin(__func__)
#define TRACE_FUNC() TRACE_SCOPE(__func__)
#define TRACE_SCOPE(SCOPE) \
char *trace_dummy __attribute__((cleanup (trace_end), unused)) = \
const char *trace_dummy __attribute__((cleanup (trace_end), unused)) = \
trace_begin(SCOPE)
#define TRACE_SCOPE_FMT(FORMAT, ...) \
char *trace_dummy __attribute__((cleanup (trace_end), unused)) = \
trace_begin_fmt(FORMAT, __VA_ARGS__)
#else
#define TRACE_INIT()
#define TRACE_FUNC()
#define TRACE_SCOPE(FORMAT, ...)
#define TRACE_SCOPE_FMT(FORMAT, ...)
#define TRACE_SCOPE(SCOPE)
#endif
#endif /* VIRGL_UTIL_H */

@ -756,7 +756,7 @@ static int vrend_decode_create_object(struct vrend_context *ctx, const uint32_t
VREND_DEBUG(dbg_object, ctx," CREATE %-18s handle:0x%x len:%d\n",
vrend_get_object_type_name(obj_type), handle, length);
TRACE_SCOPE_FMT("CREATE %-18s", vrend_get_object_type_name(obj_type));
TRACE_SCOPE(vrend_get_object_type_name(obj_type));
switch (obj_type){
case VIRGL_OBJECT_BLEND:

Loading…
Cancel
Save