gallium/u_queue: add util_queue_get_thread_time_nano
authorMarek Olšák <marek.olsak@amd.com>
Sat, 11 Feb 2017 19:51:41 +0000 (20:51 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 14 Feb 2017 20:47:51 +0000 (21:47 +0100)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_queue.c
src/gallium/auxiliary/util/u_queue.h

index 838464fb9a6a88d7f82b2a30ea1bedb927e2d519..4da5d8e9f8c3fefaf2e6c406aea4a15f0ce70c61 100644 (file)
@@ -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]);
+}
index 59646cc298be0b10f8636c77b9161eb8cb46df56..351315c5780f2c0662b1e173bbe5a967f02b273f 100644 (file)
@@ -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