From 57837813e3a2646d22fab907e450803584224b14 Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Wed, 2 Jun 2021 09:15:18 +0200 Subject: [PATCH] spdk_top: fix threads assignment to cores in THREADS tab FIxes incorrect cores showing for each thread in THREADS tab. Signed-off-by: Krzysztof Karas Change-Id: I661eac0cd70cf6ecf308dafaa940fcae8fd513f9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8153 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- app/spdk_top/spdk_top.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index 781084402..794b3d595 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -624,7 +624,7 @@ get_data(void) struct rpc_threads_stats threads_stats; struct rpc_pollers *pollers; struct rpc_poller_info *poller; - uint64_t i, j; + uint64_t i, j, k; int rc = 0; rc = rpc_send_req("thread_get_stats", &json_resp); @@ -713,7 +713,11 @@ get_data(void) core_info = &g_cores_stats.cores.core[i]; for (j = 0; j < core_info->threads.threads_count; j++) { - g_threads_stats.threads.thread_info[j].core_num = core_info->lcore; + for (k = 0; k < g_threads_stats.threads.threads_count; k++) { + if (core_info->threads.thread[j].id == g_threads_stats.threads.thread_info[k].id) { + g_threads_stats.threads.thread_info[k].core_num = core_info->lcore; + } + } } }