reactor: get_rusage directly in reactor_run

Move get_rusage directly into reactor_run(), then both
poll mode and interrupt mode can check rusage info.

Change-Id: Id5926752cfb19c13cb969fbfbb35f643e5d49d9a
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6718
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
Liu Xiaodong 2021-03-05 07:34:08 -05:00 committed by Tomasz Zawadzki
parent ee4a83360f
commit ba7aac83ed

View File

@ -871,8 +871,6 @@ reactor_interrupt_run(struct spdk_reactor *reactor)
int block_timeout = -1; /* _EPOLL_WAIT_FOREVER */
spdk_fd_group_wait(reactor->fgrp, block_timeout);
/* TODO: g_framework_context_switch_monitor_enabled */
}
static void
@ -899,13 +897,6 @@ _reactor_run(struct spdk_reactor *reactor)
reactor_post_process_lw_thread(reactor, lw_thread);
}
if (g_framework_context_switch_monitor_enabled) {
if ((reactor->last_rusage + g_rusage_period) < reactor->tsc_last) {
get_rusage(reactor);
reactor->last_rusage = reactor->tsc_last;
}
}
}
static int
@ -935,6 +926,13 @@ reactor_run(void *arg)
_reactor_run(reactor);
}
if (g_framework_context_switch_monitor_enabled) {
if ((reactor->last_rusage + g_rusage_period) < reactor->tsc_last) {
get_rusage(reactor);
reactor->last_rusage = reactor->tsc_last;
}
}
if (spdk_unlikely(g_scheduler_period > 0 &&
(reactor->tsc_last - last_sched) > g_scheduler_period &&
reactor == g_scheduling_reactor &&