Commit 7d5f0ade authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Jim Harris
Browse files

spdk_top: move core_busy_period and core_idle_period



Move these two variables below check for core_num boundary.
This ensures core_num's value can be used as index for g_cores_info
array.

Change-Id: I118a4b3a3ec61c9ccd818f3f3bd2ff013d2d7b14
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17175


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 6d7b6905
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1384,9 +1384,9 @@ draw_thread_tab_row(uint64_t current_row, uint8_t item_index)

	if (!col_desc[COL_THREADS_CPU_USAGE].disabled) {
		core_num = g_threads_info[current_row].core_num;
		if (core_num >= 0 && core_num < RPC_MAX_CORES) {
			uint64_t core_busy_period = g_cores_info[core_num].busy - g_cores_info[core_num].last_busy;
			uint64_t core_idle_period = g_cores_info[core_num].idle - g_cores_info[core_num].last_idle;
		if (core_num >= 0 && core_num < RPC_MAX_CORES) {
			get_cpu_usage_str(busy_period, core_busy_period + core_idle_period, cpu_usage);
		} else {
			snprintf(cpu_usage, sizeof(cpu_usage), "n/a");