Commit 25c5e3f5 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f1d50e8b62846cbd0f91b94f94cbaf16fefa39b
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478538


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 43d78672
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
}
+6 −6
Original line number Diff line number Diff line
@@ -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;
+2 −2
Original line number Diff line number Diff line
@@ -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);