Commit f59e9fa7 authored by Michael Piszczek's avatar Michael Piszczek Committed by Tomasz Zawadzki
Browse files

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: default avatarMichael 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
parent 0814f866
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -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;
			}
		}
	}