lib/trace: show specific usage of trace mask

Previously, if want to know which mask bit is used for specific
trace group, the only way is to check source code. Now list
each trace group with its trace tpoint group mask bit in
usage message

Change-Id: I7a85fe9c0885f1919f6ffbdc97dab81f1986fb07
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/435448
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Liu Xiaodong 2018-11-29 03:11:57 -05:00 committed by Jim Harris
parent 73a3e13280
commit 0e7ca66922
8 changed files with 36 additions and 9 deletions

View File

@ -332,7 +332,17 @@ void spdk_trace_register_description(const char *name, const char *short_name,
uint8_t object_type, uint8_t new_object,
uint8_t arg1_is_ptr, const char *arg1_name);
/**
* Show trace mask and its usage.
*
* \param f File to hold the mask's information.
* \param tmask_arg Command line option to set the trace group mask.
*/
void spdk_trace_mask_usage(FILE *f, const char *tmask_arg);
struct spdk_trace_register_fn {
const char *name;
uint8_t tgroup_id;
void (*reg_fn)(void);
struct spdk_trace_register_fn *next;
};
@ -344,9 +354,11 @@ struct spdk_trace_register_fn {
*/
void spdk_trace_add_register_fn(struct spdk_trace_register_fn *reg_fn);
#define SPDK_TRACE_REGISTER_FN(fn) \
#define SPDK_TRACE_REGISTER_FN(fn, name_str, _tgroup_id) \
static void fn(void); \
struct spdk_trace_register_fn reg_ ## fn = { \
.name = name_str, \
.tgroup_id = _tgroup_id, \
.reg_fn = fn, \
.next = NULL, \
}; \

View File

@ -4094,7 +4094,7 @@ spdk_bdev_set_qos_rate_limits(struct spdk_bdev *bdev, uint64_t *limits,
SPDK_LOG_REGISTER_COMPONENT("bdev", SPDK_LOG_BDEV)
SPDK_TRACE_REGISTER_FN(bdev_trace)
SPDK_TRACE_REGISTER_FN(bdev_trace, "bdev", TRACE_GROUP_BDEV)
{
spdk_trace_register_owner(OWNER_BDEV, 'b');
spdk_trace_register_object(OBJECT_BDEV_IO, 'i');

View File

@ -711,8 +711,6 @@ usage(void (*app_usage)(void))
printf(" -c, --config <config> config file (default %s)\n",
g_default_opts.config_file != NULL ? g_default_opts.config_file : "none");
printf(" -d, --limit-coredump do not set max coredump size to RLIM_INFINITY\n");
printf(" -e, --tpoint-group-mask <mask>\n");
printf(" tracepoint group mask for spdk trace buffers (default 0x0)\n");
printf(" -g, --single-file-segments\n");
printf(" force creating just one hugetlbfs file\n");
printf(" -h, --help show this usage\n");
@ -742,6 +740,7 @@ usage(void (*app_usage)(void))
printf(" --num-trace-entries <num> number of trace entries for each core (default %d)\n",
SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES);
spdk_tracelog_usage(stdout, "-L");
spdk_trace_mask_usage(stdout, "-e");
if (app_usage) {
app_usage();
}

View File

@ -1469,7 +1469,7 @@ spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn)
conn->logout_timer = spdk_poller_register(logout_timeout, conn, ISCSI_LOGOUT_TIMEOUT * 1000000);
}
SPDK_TRACE_REGISTER_FN(iscsi_conn_trace)
SPDK_TRACE_REGISTER_FN(iscsi_conn_trace, "iscsi_conn", TRACE_GROUP_ISCSI)
{
spdk_trace_register_owner(OWNER_ISCSI_CONN, 'c');
spdk_trace_register_object(OBJECT_ISCSI_PDU, 'p');

View File

@ -134,7 +134,7 @@ enum spdk_nvmf_rdma_request_state {
#define TRACE_RDMA_QP_DISCONNECT SPDK_TPOINT_ID(TRACE_GROUP_NVMF_RDMA, 0xF)
#define TRACE_RDMA_QP_DESTROY SPDK_TPOINT_ID(TRACE_GROUP_NVMF_RDMA, 0x10)
SPDK_TRACE_REGISTER_FN(nvmf_trace)
SPDK_TRACE_REGISTER_FN(nvmf_trace, "nvmf_rdma", TRACE_GROUP_NVMF_RDMA)
{
spdk_trace_register_object(OBJECT_NVMF_RDMA_IO, 'r');
spdk_trace_register_description("RDMA_REQ_NEW", "",

View File

@ -131,7 +131,7 @@ static const char *spdk_nvme_tcp_term_req_fes_str[] = {
#define TRACE_TCP_FLUSH_WRITEBUF_DONE SPDK_TPOINT_ID(TRACE_GROUP_NVMF_TCP, 0xB)
#define TRACE_TCP_FLUSH_WRITEBUF_PDU_DONE SPDK_TPOINT_ID(TRACE_GROUP_NVMF_TCP, 0xC)
SPDK_TRACE_REGISTER_FN(nvmf_tcp_trace)
SPDK_TRACE_REGISTER_FN(nvmf_tcp_trace, "nvmf_tcp", TRACE_GROUP_NVMF_TCP)
{
spdk_trace_register_object(OBJECT_NVMF_TCP_IO, 'r');
spdk_trace_register_description("TCP_REQ_NEW", "",

View File

@ -56,7 +56,7 @@ spdk_scsi_fini(void)
pthread_mutex_destroy(&g_spdk_scsi.mutex);
}
SPDK_TRACE_REGISTER_FN(scsi_trace)
SPDK_TRACE_REGISTER_FN(scsi_trace, "scsi", TRACE_GROUP_SCSI)
{
spdk_trace_register_owner(OWNER_SCSI_DEV, 'd');
spdk_trace_register_object(OBJECT_SCSI_TASK, 't');

View File

@ -100,6 +100,23 @@ spdk_trace_set_tpoint_group_mask(uint64_t tpoint_group_mask)
}
}
void
spdk_trace_mask_usage(FILE *f, const char *tmask_arg)
{
struct spdk_trace_register_fn *register_fn;
fprintf(f, " %s, --tpoint-group-mask <mask>\n", tmask_arg);
fprintf(f, " tracepoint group mask for spdk trace buffers (default 0x0");
register_fn = g_reg_fn_head;
while (register_fn) {
fprintf(f, ", %s 0x%x", register_fn->name, 1 << register_fn->tgroup_id);
register_fn = register_fn->next;
}
fprintf(f, ", all 0xffff)\n");
}
void
spdk_trace_register_owner(uint8_t type, char id_prefix)
{
@ -165,7 +182,6 @@ spdk_trace_add_register_fn(struct spdk_trace_register_fn *reg_fn)
g_reg_fn_head = reg_fn;
}
void
spdk_trace_flags_init(void)
{