From 50b223547814cefc0e7130e199fabc4dbedf97ce Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 30 Jun 2016 00:40:01 +0200 Subject: ddebug: record and dump apitrace call numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/ddebug/dd_util.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/gallium/drivers/ddebug/dd_util.h') diff --git a/src/gallium/drivers/ddebug/dd_util.h b/src/gallium/drivers/ddebug/dd_util.h index 093bdff4a92..3649644d28e 100644 --- a/src/gallium/drivers/ddebug/dd_util.h +++ b/src/gallium/drivers/ddebug/dd_util.h @@ -71,4 +71,27 @@ dd_get_debug_file(bool verbose) return f; } +static inline void +dd_parse_apitrace_marker(const char *string, int len, unsigned *call_number) +{ + unsigned num; + char *s; + + if (len <= 0) + return; + + /* Make it zero-terminated. */ + s = alloca(len + 1); + memcpy(s, string, len); + s[len] = 0; + + /* Parse the number. */ + errno = 0; + num = strtol(s, NULL, 10); + if (errno) + return; + + *call_number = num; +} + #endif /* DD_UTIL_H */ -- cgit v1.2.3