[Mesa-dev] [PATCH v2 17/26] gallium/u_dump: add util_dump_ns
Nicolai Hähnle
nhaehnle at gmail.com
Mon Nov 6 10:23:48 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/auxiliary/util/u_dump.h | 3 +++
src/gallium/auxiliary/util/u_dump_state.c | 10 ++++++++++
2 files changed, 13 insertions(+)
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index ff1325e1147..be9a0fa26d0 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -84,20 +84,23 @@ util_str_tex_filter(unsigned value, boolean shortened);
const char *
util_str_query_type(unsigned value, boolean shortened);
const char *
util_str_query_value_type(unsigned value, boolean shortened);
const char *
util_str_prim_mode(unsigned value, boolean shortened);
void
+util_dump_ns(FILE *f, uint64_t time);
+
+void
util_dump_ptr(FILE *stream, const void *value);
void
util_dump_query_type(FILE *stream, unsigned value);
void
util_dump_query_value_type(FILE *stream, unsigned value);
/*
* p_state.h, through a FILE
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index cef82a314f1..a2543beaf38 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -25,20 +25,22 @@
*
**************************************************************************/
#include "pipe/p_compiler.h"
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_format.h"
#include "tgsi/tgsi_dump.h"
+#include <inttypes.h>
+
#include "u_dump.h"
/*
* Dump primitives
*/
static inline void
util_stream_writef(FILE *stream, const char *format, ...)
{
@@ -68,20 +70,28 @@ util_dump_uint(FILE *stream, long long unsigned value)
{
util_stream_writef(stream, "%llu", value);
}
static void
util_dump_float(FILE *stream, double value)
{
util_stream_writef(stream, "%g", value);
}
+void
+util_dump_ns(FILE *f, uint64_t time)
+{
+ uint64_t secs = time / (1000*1000*1000);
+ unsigned usecs = (time % (1000*1000*1000)) / 1000;
+ fprintf(f, "%"PRIu64".%06us", secs, usecs);
+}
+
static void
util_dump_string(FILE *stream, const char *str)
{
fputs("\"", stream);
fputs(str, stream);
fputs("\"", stream);
}
static void
util_dump_enum(FILE *stream, const char *value)
--
2.11.0
More information about the mesa-dev
mailing list