spdk_top: fix sorting in threads tab

Currently spdk_top retains selected thread sorting for one application
loop only, because it is performed before all assignment operations are
done.
This is a problem when 'sort by core' is selected, because threads are
sorted before core assignment happens.
This patch aims to resolve that issue.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ide6d025d5e4e31a8fda713703a822e976468f326
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8629
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Krzysztof Karas 2021-07-02 15:23:56 +02:00 committed by Tomasz Zawadzki
parent d673fcee3d
commit e230f8e9e6

View File

@ -662,8 +662,6 @@ get_thread_data(void)
}
}
memcpy(&g_threads_stats, &threads_stats, sizeof(struct rpc_threads_stats));
qsort(&g_threads_stats.threads.thread_info, threads_stats.threads.threads_count,
sizeof(g_threads_stats.threads.thread_info[0]), sort_threads);
for (i = 0; i < g_threads_stats.threads.threads_count; i++) {
g_threads_stats.threads.thread_info[i].core_num = -1;
@ -687,6 +685,9 @@ get_thread_data(void)
}
}
qsort(&g_threads_stats.threads.thread_info, threads_stats.threads.threads_count,
sizeof(g_threads_stats.threads.thread_info[0]), sort_threads);
pthread_mutex_unlock(&g_thread_lock);
end: