summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2017-10-22 17:38:56 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2017-11-06 11:09:48 +0100
commit862625acac628be7d7de93eeeaa7f244be1ff6b9 (patch)
treecb9c82c964c26d9e88722191946445f91544cfcf
parentd2051a0ff10161eb4aa78d2cbbe047b773c02341 (diff)
gallium/u_dump: add util_dump_ns
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
-rw-r--r--src/gallium/auxiliary/util/u_dump.h3
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c10
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index ff1325e114..be9a0fa26d 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -91,6 +91,9 @@ 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
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index cef82a314f..a2543beaf3 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -32,6 +32,8 @@
#include "util/u_format.h"
#include "tgsi/tgsi_dump.h"
+#include <inttypes.h>
+
#include "u_dump.h"
@@ -75,6 +77,14 @@ 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)
{