gallium/radeon: add a query for monitoring Gallium thread load
authorMarek Olšák <marek.olsak@amd.com>
Fri, 12 May 2017 23:08:03 +0000 (01:08 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 22 May 2017 17:23:39 +0000 (19:23 +0200)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600_query.h

index 61fd6626b97ab7db693aaf6406c3ff05fe81edae..0d960bc4032bb864ed83ff895aa8fff7e990953b 100644 (file)
@@ -170,6 +170,11 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,
                query->begin_result = rctx->ws->query_value(rctx->ws, ws_id);
                query->begin_time = os_time_get_nano();
                break;
+       case R600_QUERY_GALLIUM_THREAD_BUSY:
+               query->begin_result =
+                       rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0;
+               query->begin_time = os_time_get_nano();
+               break;
        case R600_QUERY_GPU_LOAD:
        case R600_QUERY_GPU_SHADERS_BUSY:
        case R600_QUERY_GPU_TA_BUSY:
@@ -303,6 +308,11 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,
                query->end_result = rctx->ws->query_value(rctx->ws, ws_id);
                query->end_time = os_time_get_nano();
                break;
+       case R600_QUERY_GALLIUM_THREAD_BUSY:
+               query->end_result =
+                       rctx->tc ? util_queue_get_thread_time_nano(&rctx->tc->queue, 0) : 0;
+               query->end_time = os_time_get_nano();
+               break;
        case R600_QUERY_GPU_LOAD:
        case R600_QUERY_GPU_SHADERS_BUSY:
        case R600_QUERY_GPU_TA_BUSY:
@@ -380,6 +390,7 @@ static bool r600_query_sw_get_result(struct r600_common_context *rctx,
        }
 
        case R600_QUERY_CS_THREAD_BUSY:
+       case R600_QUERY_GALLIUM_THREAD_BUSY:
                result->u64 = (query->end_result - query->begin_result) * 100 /
                              (query->end_time - query->begin_time);
                return true;
@@ -1824,6 +1835,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
        X("tc-direct-slots",            TC_DIRECT_SLOTS,        UINT64, AVERAGE),
        X("tc-num-syncs",               TC_NUM_SYNCS,           UINT64, AVERAGE),
        X("CS-thread-busy",             CS_THREAD_BUSY,         UINT64, AVERAGE),
+       X("gallium-thread-busy",        GALLIUM_THREAD_BUSY,    UINT64, AVERAGE),
        X("requested-VRAM",             REQUESTED_VRAM,         BYTES, AVERAGE),
        X("requested-GTT",              REQUESTED_GTT,          BYTES, AVERAGE),
        X("mapped-VRAM",                MAPPED_VRAM,            BYTES, AVERAGE),
index cf99d3ab76a2051409e904b315727c19a94f0e11..9017fdf649fcb53d41a203bdd954625f6ef3eeac 100644 (file)
@@ -58,6 +58,7 @@ enum {
        R600_QUERY_TC_DIRECT_SLOTS,
        R600_QUERY_TC_NUM_SYNCS,
        R600_QUERY_CS_THREAD_BUSY,
+       R600_QUERY_GALLIUM_THREAD_BUSY,
        R600_QUERY_REQUESTED_VRAM,
        R600_QUERY_REQUESTED_GTT,
        R600_QUERY_MAPPED_VRAM,