From 626e4ef18f1ffc521ab3e6faef3173abedd52dbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 11 Feb 2017 20:51:41 +0100 Subject: [PATCH] gallium/u_queue: add util_queue_get_thread_time_nano MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle --- src/gallium/auxiliary/util/u_queue.c | 10 ++++++++++ src/gallium/auxiliary/util/u_queue.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/gallium/auxiliary/util/u_queue.c b/src/gallium/auxiliary/util/u_queue.c index 838464fb9a6..4da5d8e9f8c 100644 --- a/src/gallium/auxiliary/util/u_queue.c +++ b/src/gallium/auxiliary/util/u_queue.c @@ -242,3 +242,13 @@ util_queue_add_job(struct util_queue *queue, pipe_condvar_signal(queue->has_queued_cond); pipe_mutex_unlock(queue->lock); } + +int64_t +util_queue_get_thread_time_nano(struct util_queue *queue, unsigned thread_index) +{ + /* Allow some flexibility by not raising an error. */ + if (thread_index >= queue->num_threads) + return 0; + + return pipe_thread_get_time_nano(queue->threads[thread_index]); +} diff --git a/src/gallium/auxiliary/util/u_queue.h b/src/gallium/auxiliary/util/u_queue.h index 59646cc298b..351315c5780 100644 --- a/src/gallium/auxiliary/util/u_queue.h +++ b/src/gallium/auxiliary/util/u_queue.h @@ -84,6 +84,8 @@ void util_queue_add_job(struct util_queue *queue, util_queue_execute_func cleanup); void util_queue_job_wait(struct util_queue_fence *fence); +int64_t util_queue_get_thread_time_nano(struct util_queue *queue, + unsigned thread_index); /* util_queue needs to be cleared to zeroes for this to work */ static inline bool -- 2.30.2