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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I634da46c411d648837538ebf227074d307273c97
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475187
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Alexey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2019-12-08 18:32:41 -05:00 committed by Tomasz Zawadzki
parent b3d982036a
commit b99df8ee33
2 changed files with 6 additions and 2 deletions

View File

@ -518,7 +518,8 @@ Example response:
"ticks": 2523538189523655,
"threads": [
{
"name": "reactor_0",
"name": "app_thread",
"cpumask": "1",
"busy": 139223208,
"idle": 8641080608
}

View File

@ -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);