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

app/rpc: Add cpumask to output of thread_get_stats RPC



Thread's core affinity had not been visible to users.  This patch
adds thread's core affinity information to the existing
thread_get_stats RPC.  We can create an new RPC to retrieve
thread's core affinity information but using thread_get_stats
RPC will be enough for now.

Besides, the name of SPDK thread 0 is not reactor_0 but app_thread
now.  So fix it together in this patch.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I634da46c411d648837538ebf227074d307273c97
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475187


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
parent b3d98203
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -518,7 +518,8 @@ Example response:
    "ticks": 2523538189523655,
    "threads": [
      {
        "name": "reactor_0",
        "name": "app_thread",
	"cpumask": "1",
        "busy": 139223208,
        "idle": 8641080608
      }
+4 −1
Original line number Diff line number Diff line
@@ -173,11 +173,14 @@ static void
rpc_thread_get_stats(void *arg)
{
	struct rpc_thread_get_stats_ctx *ctx = arg;
	struct spdk_thread *thread = spdk_get_thread();
	struct spdk_thread_stats stats;

	if (0 == spdk_thread_get_stats(&stats)) {
		spdk_json_write_object_begin(ctx->w);
		spdk_json_write_named_string(ctx->w, "name", spdk_thread_get_name(spdk_get_thread()));
		spdk_json_write_named_string(ctx->w, "name", spdk_thread_get_name(thread));
		spdk_json_write_named_string(ctx->w, "cpumask",
					     spdk_cpuset_fmt(spdk_thread_get_cpumask(thread)));
		spdk_json_write_named_uint64(ctx->w, "busy", stats.busy_tsc);
		spdk_json_write_named_uint64(ctx->w, "idle", stats.idle_tsc);
		spdk_json_write_object_end(ctx->w);