event: Save thread stats to last_stats field in spdk_lw_thread structure
This field will be used in upcoming patches by scheduler to keep a history of threads statistics. Base on those scheduler will be able to calculate how busy a thread is. Also we have to save the value of this field while rescheduling thread. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Iffbd1f946e1d159ec7277a39bc30161e71722456 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5972 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
parent
aa22321aca
commit
80a13be9f5
@ -68,6 +68,7 @@ struct spdk_lw_thread {
|
|||||||
bool resched;
|
bool resched;
|
||||||
struct spdk_thread_stats current_stats;
|
struct spdk_thread_stats current_stats;
|
||||||
struct spdk_thread_stats snapshot_stats;
|
struct spdk_thread_stats snapshot_stats;
|
||||||
|
struct spdk_thread_stats last_stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_reactor {
|
struct spdk_reactor {
|
||||||
|
@ -910,6 +910,7 @@ _reactor_schedule_thread(struct spdk_thread *thread)
|
|||||||
{
|
{
|
||||||
uint32_t core;
|
uint32_t core;
|
||||||
struct spdk_lw_thread *lw_thread;
|
struct spdk_lw_thread *lw_thread;
|
||||||
|
struct spdk_thread_stats last_stats;
|
||||||
struct spdk_event *evt = NULL;
|
struct spdk_event *evt = NULL;
|
||||||
struct spdk_cpuset *cpumask;
|
struct spdk_cpuset *cpumask;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
@ -919,7 +920,9 @@ _reactor_schedule_thread(struct spdk_thread *thread)
|
|||||||
lw_thread = spdk_thread_get_ctx(thread);
|
lw_thread = spdk_thread_get_ctx(thread);
|
||||||
assert(lw_thread != NULL);
|
assert(lw_thread != NULL);
|
||||||
core = lw_thread->lcore;
|
core = lw_thread->lcore;
|
||||||
|
last_stats = lw_thread->last_stats;
|
||||||
memset(lw_thread, 0, sizeof(*lw_thread));
|
memset(lw_thread, 0, sizeof(*lw_thread));
|
||||||
|
lw_thread->last_stats = last_stats;
|
||||||
|
|
||||||
pthread_mutex_lock(&g_scheduler_mtx);
|
pthread_mutex_lock(&g_scheduler_mtx);
|
||||||
if (core == SPDK_ENV_LCORE_ID_ANY) {
|
if (core == SPDK_ENV_LCORE_ID_ANY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user