From 9b8033a4a7e52a4db4d60ce6e70fb30c9a9224fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 22 Oct 2017 17:38:56 +0200 Subject: [PATCH] gallium/u_dump: add util_dump_ns MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- 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 @@ -90,6 +90,9 @@ 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); 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 @@ -32,6 +32,8 @@ #include "util/u_format.h" #include "tgsi/tgsi_dump.h" +#include + #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) { -- 2.30.2