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: Krzysztof 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Krzysztof Karas 2021-05-21 08:39:15 +02:00 committed by Tomasz Zawadzki
parent fbcfcb9807
commit e9af400888

View File

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