diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 5637d0d2d..cf643fb1d 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -91,7 +91,7 @@ Example response: } ~~~ -## context_switch_monitor {#rpc_context_switch_monitor} +## framework_monitor_context_switch {#rpc_framework_monitor_context_switch} Query, enable, or disable the context switch monitoring functionality. @@ -115,7 +115,7 @@ Example request: { "jsonrpc": "2.0", "id": 1, - "method": "context_switch_monitor", + "method": "framework_monitor_context_switch", "params": { "enabled": false } @@ -277,7 +277,7 @@ Example response: "bdev_get_iostat", "get_subsystem_config", "get_subsystems", - "context_switch_monitor", + "framework_monitor_context_switch", "spdk_kill_instance", "ioat_scan_copy_engine", "bdev_virtio_attach_controller", diff --git a/include/spdk/event.h b/include/spdk/event.h index 88532af94..b5e53c77c 100644 --- a/include/spdk/event.h +++ b/include/spdk/event.h @@ -296,14 +296,14 @@ void spdk_event_call(struct spdk_event *event); * * \param enabled True to enable, false to disable. */ -void spdk_reactor_enable_context_switch_monitor(bool enabled); +void spdk_reactor_enable_framework_monitor_context_switch(bool enabled); /** * Return whether context switch monitoring is enabled. * * \return true if enabled or false otherwise. */ -bool spdk_reactor_context_switch_monitor_enabled(void); +bool spdk_reactor_framework_monitor_context_switch_enabled(void); #ifdef __cplusplus } diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 9250f193f..b3cb09dff 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -87,7 +87,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_INVALID; -static bool g_context_switch_monitor_enabled = true; +static bool g_framework_monitor_context_switch_enabled = true; static struct spdk_mempool *g_spdk_event_mempool = NULL; @@ -301,19 +301,19 @@ get_rusage(struct spdk_reactor *reactor) } void -spdk_reactor_enable_context_switch_monitor(bool enable) +spdk_reactor_enable_framework_monitor_context_switch(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_context_switch_monitor_enabled = enable; + g_framework_monitor_context_switch_enabled = enable; } bool -spdk_reactor_context_switch_monitor_enabled(void) +spdk_reactor_framework_monitor_context_switch_enabled(void) { - return g_context_switch_monitor_enabled; + return g_framework_monitor_context_switch_enabled; } static void @@ -369,7 +369,7 @@ _spdk_reactor_run(void *arg) break; } - if (g_context_switch_monitor_enabled) { + if (g_framework_monitor_context_switch_enabled) { if ((last_rusage + CONTEXT_SWITCH_MONITOR_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 b208773e2..08670b4bc 100644 --- a/module/event/rpc/app_rpc.c +++ b/module/event/rpc/app_rpc.c @@ -112,43 +112,45 @@ SPDK_RPC_REGISTER("spdk_kill_instance", spdk_rpc_spdk_kill_instance, SPDK_RPC_RU SPDK_RPC_REGISTER_ALIAS_DEPRECATED(spdk_kill_instance, kill_instance) -struct rpc_context_switch_monitor { +struct rpc_framework_monitor_context_switch { bool enabled; }; -static const struct spdk_json_object_decoder rpc_context_switch_monitor_decoders[] = { - {"enabled", offsetof(struct rpc_context_switch_monitor, enabled), spdk_json_decode_bool}, +static const struct spdk_json_object_decoder rpc_framework_monitor_context_switch_decoders[] = { + {"enabled", offsetof(struct rpc_framework_monitor_context_switch, enabled), spdk_json_decode_bool}, }; static void -spdk_rpc_context_switch_monitor(struct spdk_jsonrpc_request *request, - const struct spdk_json_val *params) +spdk_rpc_framework_monitor_context_switch(struct spdk_jsonrpc_request *request, + const struct spdk_json_val *params) { - struct rpc_context_switch_monitor req = {}; + struct rpc_framework_monitor_context_switch req = {}; struct spdk_json_write_ctx *w; if (params != NULL) { - if (spdk_json_decode_object(params, rpc_context_switch_monitor_decoders, - SPDK_COUNTOF(rpc_context_switch_monitor_decoders), + if (spdk_json_decode_object(params, rpc_framework_monitor_context_switch_decoders, + SPDK_COUNTOF(rpc_framework_monitor_context_switch_decoders), &req)) { SPDK_DEBUGLOG(SPDK_LOG_REACTOR, "spdk_json_decode_object failed\n"); spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid parameters"); return; } - spdk_reactor_enable_context_switch_monitor(req.enabled); + spdk_reactor_enable_framework_monitor_context_switch(req.enabled); } w = spdk_jsonrpc_begin_result(request); spdk_json_write_object_begin(w); - spdk_json_write_named_bool(w, "enabled", spdk_reactor_context_switch_monitor_enabled()); + spdk_json_write_named_bool(w, "enabled", spdk_reactor_framework_monitor_context_switch_enabled()); spdk_json_write_object_end(w); spdk_jsonrpc_end_result(request, w); } -SPDK_RPC_REGISTER("context_switch_monitor", spdk_rpc_context_switch_monitor, SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER("framework_monitor_context_switch", spdk_rpc_framework_monitor_context_switch, + SPDK_RPC_RUNTIME) +SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_monitor_context_switch, context_switch_monitor) struct rpc_thread_get_stats_ctx { struct spdk_jsonrpc_request *request; diff --git a/scripts/rpc.py b/scripts/rpc.py index 258465312..dad469f92 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -120,19 +120,20 @@ if __name__ == "__main__": p.add_argument('sig_name', help='signal will be sent to server.') p.set_defaults(func=spdk_kill_instance) - def context_switch_monitor(args): + def framework_monitor_context_switch(args): enabled = None if args.enable: enabled = True if args.disable: enabled = False - print_dict(rpc.app.context_switch_monitor(args.client, - enabled=enabled)) + print_dict(rpc.app.framework_monitor_context_switch(args.client, + enabled=enabled)) - p = subparsers.add_parser('context_switch_monitor', help='Control whether the context switch monitor is enabled') + p = subparsers.add_parser('framework_monitor_context_switch', aliases=['context_switch_monitor'], + help='Control whether the context switch monitor is enabled') p.add_argument('-e', '--enable', action='store_true', help='Enable context switch monitoring') p.add_argument('-d', '--disable', action='store_true', help='Disable context switch monitoring') - p.set_defaults(func=context_switch_monitor) + p.set_defaults(func=framework_monitor_context_switch) # bdev def bdev_set_options(args): diff --git a/scripts/rpc/app.py b/scripts/rpc/app.py index c964fb277..4fc3a9ff4 100644 --- a/scripts/rpc/app.py +++ b/scripts/rpc/app.py @@ -12,7 +12,8 @@ def spdk_kill_instance(client, sig_name): return client.call('spdk_kill_instance', params) -def context_switch_monitor(client, enabled=None): +@deprecated_alias('context_switch_monitor') +def framework_monitor_context_switch(client, enabled=None): """Query or set state of context switch monitoring. Args: @@ -24,7 +25,7 @@ def context_switch_monitor(client, enabled=None): params = {} if enabled is not None: params['enabled'] = enabled - return client.call('context_switch_monitor', params) + return client.call('framework_monitor_context_switch', params) def thread_get_stats(client):