From 584fb373eb60cb05c1c444c207da6486d2dc464e Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Thu, 26 Nov 2020 10:28:15 +0100 Subject: [PATCH] scheduler: copy snapshot of thread stats to new spdk_lw_thread field This will be used by a scheduler while balancing threads to get information how much busy a thread is. Signed-off-by: Maciej Szwed Change-Id: Ib0e897a9bb5d2a71173f60cce7e1d442e67a57f9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5253 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto --- include/spdk_internal/event.h | 3 ++- lib/event/reactor.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/spdk_internal/event.h b/include/spdk_internal/event.h index 474e0ccd3..0a7173bc2 100644 --- a/include/spdk_internal/event.h +++ b/include/spdk_internal/event.h @@ -66,7 +66,8 @@ struct spdk_lw_thread { uint32_t lcore; uint32_t new_lcore; bool resched; - struct spdk_thread_stats current_stats; + struct spdk_thread_stats current_stats; + struct spdk_thread_stats snapshot_stats; }; struct spdk_reactor { diff --git a/lib/event/reactor.c b/lib/event/reactor.c index f449763d6..3b2d2f034 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -581,6 +581,7 @@ _reactors_scheduler_gather_metrics(void *arg1, void *arg2) i = 0; TAILQ_FOREACH(lw_thread, &reactor->threads, link) { core_info->threads[i] = lw_thread; + _spdk_lw_thread_get_current_stats(lw_thread, &lw_thread->snapshot_stats); i++; } }