Commit cd4ac9c7 authored by Xinrui Mao's avatar Xinrui Mao Committed by Konrad Sztyber
Browse files

lib/trace: add trace_get_info RPC



Add rpc method trace_get_info to show name of shared memory file,
list of the available trace point groups and mask of the available trace points for each group.

Fixes #2747

Signed-off-by: default avatarXinrui Mao <xinrui.mao@intel.com>
Change-Id: I2098283bed454dc46644fd2ca1b9568ab2aea81b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15426


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
parent c680e3a0
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ Added spdk_rpc_set_allowlist to restrict allowed RPCs to the specified list.
Promoted the application to example to match similar programs: fio_plugin and perf.
It can now be found inside `examples/bdev/bdevperf`.

### trace

New `trace_get_info` RPC was added to get name of shared memory file, list of the
available trace point groups and mask of the available trace points for each group.

### util

New API `spdk_fd_group_get_epoll_event` that returns the epoll(7) event that
+70 −0
Original line number Diff line number Diff line
@@ -1173,6 +1173,76 @@ Example response:
}
~~~

### trace_get_info {#rpc_trace_get_info}

Get name of shared memory file, list of the available trace point groups
and mask of the available trace points for each group

#### Parameters

No parameters required

#### Example

Example request:

~~~json
{
  "jsonrpc": "2.0",
  "method": "trace_get_info",
  "id": 1
}
~~~

Example response:

~~~json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tpoint_shm_path": "/dev/shm/spdk_tgt_trace.pid3071944",
    "tpoint_group_mask": "0x8",
    "iscsi_conn": {
      "mask": "0x2",
      "tpoint_mask": "0x0"
    },
    "scsi": {
      "mask": "0x4",
      "tpoint_mask": "0x0"
    },
    "bdev": {
      "mask": "0x8",
      "tpoint_mask": "0xffffffffffffffff"
    },
    "nvmf_tcp": {
      "mask": "0x20",
      "tpoint_mask": "0x0"
    },
    "blobfs": {
      "mask": "0x80",
      "tpoint_mask": "0x0"
    },
    "thread": {
      "mask": "0x400",
      "tpoint_mask": "0x0"
    },
    "nvme_pcie": {
      "mask": "0x800",
      "tpoint_mask": "0x0"
    },
    "nvme_tcp": {
      "mask": "0x2000",
      "tpoint_mask": "0x0"
    },
    "bdev_nvme": {
      "mask": "0x4000",
      "tpoint_mask": "0x0"
    }
  }
}
~~~

### log_set_print_level {#rpc_log_set_print_level}

Set the current level at which output will additionally be
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 7
SO_MINOR := 0
SO_MINOR := 1

C_SRCS = trace.c trace_flags.c trace_rpc.c
LIBNAME = trace
+7 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include "spdk/log.h"
#include "spdk/cpuset.h"
#include "spdk/likely.h"
#include "trace_internal.h"

static int g_trace_fd = -1;
static char g_shm_name[64];
@@ -271,3 +272,9 @@ spdk_trace_cleanup(void)
		shm_unlink(g_shm_name);
	}
}

const char *
trace_get_shm_name(void)
{
	return g_shm_name;
}
+14 −0
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (C) 2022 Intel Corporation.
 *   All rights reserved.
 */

#ifndef __TRACE_INTERNAL_H__
#define __TRACE_INTERNAL_H__

#include "spdk/trace.h"

/* Get shared memory file name. */
const char *trace_get_shm_name(void);

#endif
Loading