From 6f9d1248886e635d51df3423ed5512d9c437e4c7 Mon Sep 17 00:00:00 2001 From: Krzysztof Karas Date: Wed, 19 May 2021 12:08:59 +0200 Subject: [PATCH] spdk_top: change where sore_last_run_counter() is called Changes where store_last_run_function() is called. Before this patch this function was used inside refresh_pollers_tab() and it overwrote last run counters of each poller before show_poller() function had a chance to use them. As a result poller details window was always showing zeroes instead of actual difference in run count between each application loop. Signed-off-by: Krzysztof Karas Change-Id: I96219698f7f0b51b94ffe8c0d6bf40f73cbf8a82 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7951 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki Reviewed-by: Paul Luse Reviewed-by: Aleksey Marchuk --- app/spdk_top/spdk_top.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index 1235e8c7e..463e441f8 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -622,6 +622,8 @@ get_data(void) struct spdk_jsonrpc_client_response *json_resp = NULL; struct rpc_core_info *core_info; struct rpc_threads_stats threads_stats; + struct rpc_pollers *pollers; + struct rpc_poller_info *poller; uint64_t i, j; int rc = 0; @@ -659,6 +661,25 @@ get_data(void) goto end; } + /* Save last run counter of each poller before updating g_pollers_stats */ + for (i = 0; i < g_pollers_stats.pollers_threads.threads_count; i++) { + pollers = &g_pollers_stats.pollers_threads.threads[i].active_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 = &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 = &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); + } + } + /* Free old pollers values before allocating memory for new ones */ free_rpc_pollers_stats(&g_pollers_stats); @@ -1224,8 +1245,6 @@ refresh_pollers_tab(uint8_t current_page) col += col_desc[3].max_data_string + 4; } - store_last_run_counter(pollers[i]->name, pollers[i]->thread_id, pollers[i]->run_count); - if (!col_desc[5].disabled) { if (pollers[i]->busy_count > 0) { if (item_index != g_selected_row) {