From 25c5e3f59ddf0bdf62d95a403f559c8fe96efc27 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 19 Dec 2019 19:06:44 -0500 Subject: [PATCH] lib/event: Rename context switch monitoring APIs to be concise spdk_reactor_enable_framework_monitor_context_switch and spdk_reactor_framework_monitor_context_switch_enabled had been a little long and not easy to get the meaning. spdk_framework_enable_context_switch_monitor and spdk_framework_context_switch_monitor_enabled will be a little more concise, and hence change the names accordingly. Signed-off-by: Shuhei Matsumoto Change-Id: I5f1d50e8b62846cbd0f91b94f94cbaf16fefa39b Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478538 Tested-by: SPDK CI Jenkins Community-CI: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki --- CHANGELOG.md | 7 +++++++ include/spdk/event.h | 4 ++-- lib/event/reactor.c | 12 ++++++------ module/event/rpc/app_rpc.c | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1474b7b40..f82bd9c3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,13 @@ An new RPC `framework_get_reactors` has been added to retrieve list of all react Updated DPDK submodule to DPDK 19.11. +### event + +The functions `spdk_reactor_enable_framework_monitor_context_switch()` and +`spdk_reactor_framework_monitor_context_switch_enabled()` have been changed to +`spdk_framework_enable_context_switch_monitor()` and +`spdk_framework_context_switch_monitor_enabled()`, respectively. + ## v19.10: ### rpc diff --git a/include/spdk/event.h b/include/spdk/event.h index 90adf07c6..7d57b2186 100644 --- a/include/spdk/event.h +++ b/include/spdk/event.h @@ -289,14 +289,14 @@ void spdk_event_call(struct spdk_event *event); * * \param enabled True to enable, false to disable. */ -void spdk_reactor_enable_framework_monitor_context_switch(bool enabled); +void spdk_framework_enable_context_switch_monitor(bool enabled); /** * Return whether context switch monitoring is enabled. * * \return true if enabled or false otherwise. */ -bool spdk_reactor_framework_monitor_context_switch_enabled(void); +bool spdk_framework_context_switch_monitor_enabled(void); #ifdef __cplusplus } diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 245a3934b..d848e65c9 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -57,7 +57,7 @@ static struct spdk_reactor *g_reactors; static struct spdk_cpuset g_reactor_core_mask; static enum spdk_reactor_state g_reactor_state = SPDK_REACTOR_STATE_UNINITIALIZED; -static bool g_framework_monitor_context_switch_enabled = true; +static bool g_framework_context_switch_monitor_enabled = true; static struct spdk_mempool *g_spdk_event_mempool = NULL; @@ -276,19 +276,19 @@ get_rusage(struct spdk_reactor *reactor) } void -spdk_reactor_enable_framework_monitor_context_switch(bool enable) +spdk_framework_enable_context_switch_monitor(bool enable) { /* This global is being read by multiple threads, so this isn't * strictly thread safe. However, we're toggling between true and * false here, and if a thread sees the value update later than it * should, it's no big deal. */ - g_framework_monitor_context_switch_enabled = enable; + g_framework_context_switch_monitor_enabled = enable; } bool -spdk_reactor_framework_monitor_context_switch_enabled(void) +spdk_framework_context_switch_monitor_enabled(void) { - return g_framework_monitor_context_switch_enabled; + return g_framework_context_switch_monitor_enabled; } static void @@ -341,7 +341,7 @@ _spdk_reactor_run(void *arg) break; } - if (g_framework_monitor_context_switch_enabled) { + if (g_framework_context_switch_monitor_enabled) { if ((last_rusage + rusage_period) < now) { get_rusage(reactor); last_rusage = now; diff --git a/module/event/rpc/app_rpc.c b/module/event/rpc/app_rpc.c index 3385e63ec..6211f5227 100644 --- a/module/event/rpc/app_rpc.c +++ b/module/event/rpc/app_rpc.c @@ -137,13 +137,13 @@ spdk_rpc_framework_monitor_context_switch(struct spdk_jsonrpc_request *request, return; } - spdk_reactor_enable_framework_monitor_context_switch(req.enabled); + spdk_framework_enable_context_switch_monitor(req.enabled); } w = spdk_jsonrpc_begin_result(request); spdk_json_write_object_begin(w); - spdk_json_write_named_bool(w, "enabled", spdk_reactor_framework_monitor_context_switch_enabled()); + spdk_json_write_named_bool(w, "enabled", spdk_framework_context_switch_monitor_enabled()); spdk_json_write_object_end(w); spdk_jsonrpc_end_result(request, w);