From 648cf7163bec861c91a589d14d4a9c712305b30b Mon Sep 17 00:00:00 2001 From: Michael Piszczek Date: Wed, 3 Nov 2021 11:19:26 -0400 Subject: [PATCH] spdk_top: Fix missing poller and core sort cases Added missing sorts for pollers by busy count and cores by frequency and cores by in interrupt. Signed-off-by: Michael Piszczek Change-Id: Ie8cf7f11961dd727d59bd406be320ce4d25c7573 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10104 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Krzysztof Karas --- app/spdk_top/spdk_top.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c index aec874084..71801a786 100644 --- a/app/spdk_top/spdk_top.c +++ b/app/spdk_top/spdk_top.c @@ -764,6 +764,7 @@ sort_pollers(const void *p1, const void *p2, void *arg) const struct rpc_poller_info *poller2 = (struct rpc_poller_info *)p2; enum sort_type sorting = *(enum sort_type *)arg; uint64_t count1, count2; + uint64_t last_busy_counter1, last_busy_counter2; if (sorting == BY_NAME) { /* Sorting by name requested explicitly */ @@ -790,6 +791,20 @@ sort_pollers(const void *p1, const void *p2, void *arg) count1 = poller1->period_ticks; count2 = poller2->period_ticks; break; + case 5: /* Sort by busy count */ + count1 = poller1->busy_count; + count2 = poller2->busy_count; + if (g_interval_data) { + last_busy_counter1 = get_last_busy_counter(poller1->name, poller1->thread_id); + last_busy_counter2 = get_last_busy_counter(poller2->name, poller2->thread_id); + if (count1 > last_busy_counter1) { + count1 -= last_busy_counter1; + } + if (count2 > last_busy_counter2) { + count2 -= last_busy_counter2; + } + } + break; default: return 0; } @@ -898,6 +913,14 @@ sort_cores(const void *p1, const void *p2) count2 = core_info2.busy; } break; + case 5: /* Sort by core frequency */ + count1 = core_info1.core_freq; + count2 = core_info2.core_freq; + break; + case 6: /* Sort by in interrupt */ + count1 = core_info1.in_interrupt; + count2 = core_info2.in_interrupt; + break; default: return 0; }