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 <mpiszczek@ddn.com>
Change-Id: I2c26019f4b1081fdb6a58f6fefb47bb8102ddfc9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9882
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
Michael Piszczek 2021-10-14 10:13:39 -04:00 committed by Tomasz Zawadzki
parent 0814f8662a
commit f59e9fa754

View File

@ -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;
}
}
}