Commit e9af4008 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

spdk_top: change where g_last_pollers_count is set



The goal of this patch is to set g_last_pollers_count
earlier than it was originally done to allocate less
memory for pollers array in refresh_pollers_tab(),
which is done in the next patch.

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


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent fbcfcb98
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -627,6 +627,7 @@ get_data(void)
	struct rpc_pollers *pollers;
	struct rpc_poller_info *poller;
	uint64_t i, j, k;
	uint64_t pollers_count = 0;
	int rc = 0;

	rc = rpc_send_req("thread_get_stats", &json_resp);
@@ -670,17 +671,23 @@ get_data(void)
			poller = &pollers->pollers[j];
			store_last_run_counter(poller->name, poller->thread_id, poller->run_count);
		}
		pollers_count += pollers->pollers_count;

		pollers = &g_pollers_stats.pollers_threads.threads[i].timed_pollers;
		for (j = 0; j < pollers->pollers_count; j++) {
			poller = &pollers->pollers[j];
			store_last_run_counter(poller->name, poller->thread_id, poller->run_count);
		}
		pollers_count += pollers->pollers_count;

		pollers = &g_pollers_stats.pollers_threads.threads[i].paused_pollers;
		for (j = 0; j < pollers->pollers_count; j++) {
			poller = &pollers->pollers[j];
			store_last_run_counter(poller->name, poller->thread_id, poller->run_count);
		}
		pollers_count += pollers->pollers_count;
	}
	g_last_pollers_count = pollers_count;

	/* Free old pollers values before allocating memory for new ones */
	free_rpc_pollers_stats(&g_pollers_stats);
@@ -1191,8 +1198,6 @@ refresh_pollers_tab(uint8_t current_page)
			}
		}

		g_last_pollers_count = count;

		/* We need to run store_last_run_counter() again, so the easiest way is to call this function
		 * again with changed g_last_page value */
		g_last_page = 0xF;