From f59e9fa754e73b05132b2fa1ce74f3a7f670907f Mon Sep 17 00:00:00 2001 From: Michael Piszczek Date: Thu, 14 Oct 2021 10:13:39 -0400 Subject: [PATCH] spdk_top: Fix core idle and busy us display Select the correct logical core when saving the last_busy and last idle data. Signed-off-by: Michael Piszczek Change-Id: I2c26019f4b1081fdb6a58f6fefb47bb8102ddfc9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9882 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Krzysztof Karas --- app/spdk_top/spdk_top.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index 18e8831f2..aec874084 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -934,21 +934,19 @@ get_cores_data(void) } pthread_mutex_lock(&g_thread_lock); - - for (i = 0; i < current_cores_count; i++) { - cores_info[i].last_busy = g_cores_info[i].busy; - cores_info[i].last_idle = g_cores_info[i].idle; - } - for (i = 0; i < current_cores_count; i++) { for (j = 0; j < g_last_cores_count; j++) { + if (cores_info[i].lcore == g_cores_info[j].lcore) { + cores_info[i].last_busy = g_cores_info[j].busy; + cores_info[i].last_idle = g_cores_info[j].idle; + } /* Do not consider threads which changed cores when issuing * RPCs to get_core_data and get_thread_data and threads * not currently assigned to this core. */ - if ((int)cores_info[j].lcore == g_threads_info[i].core_num) { - cores_info[j].pollers_count += g_threads_info[i].active_pollers_count + - g_threads_info[i].timed_pollers_count + - g_threads_info[i].paused_pollers_count; + if ((int)cores_info[i].lcore == g_threads_info[j].core_num) { + cores_info[i].pollers_count += g_threads_info[j].active_pollers_count + + g_threads_info[j].timed_pollers_count + + g_threads_info[j].paused_pollers_count; } } }