lib/trace: don't format arg's name while registering a tpoint

The arguments of a tracepoint are formatted when they're printed now, so
there's no need to append ":" or pad it with spaces.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I74f5568f1982dacc079e3b80bd19a9cd740b48ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7955
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-05-17 14:35:44 +02:00 committed by Tomasz Zawadzki
parent 462eb754a2
commit 441431d228
6 changed files with 61 additions and 52 deletions

View File

@ -93,10 +93,19 @@ get_us_from_tsc(uint64_t tsc, uint64_t tsc_rate)
return ((float)tsc) * 1000 * 1000 / tsc_rate;
}
static const char *
format_argname(const char *name)
{
static char namebuf[16];
snprintf(namebuf, sizeof(namebuf), "%s: ", name);
return namebuf;
}
static void
print_ptr(const char *arg_string, uint64_t arg)
{
printf("%-7.7s0x%-14jx ", arg_string, arg);
printf("%-7.7s0x%-14jx ", format_argname(arg_string), arg);
}
static void
@ -107,14 +116,14 @@ print_uint64(const char *arg_string, uint64_t arg)
* for FLUSH WRITEBUF when writev() returns -1 due to full
* socket buffer.
*/
printf("%-7.7s%-16jd ", arg_string, arg);
printf("%-7.7s%-16jd ", format_argname(arg_string), arg);
}
static void
print_string(const char *arg_string, uint64_t arg)
{
char *str = (char *)&arg;
printf("%-7.7s%.8s ", arg_string, str);
printf("%-7.7s%.8s ", format_argname(arg_string), str);
}
static void
@ -136,7 +145,7 @@ print_object_id(uint8_t type, uint64_t id)
static void
print_float(const char *arg_string, float arg)
{
printf("%-7s%-16.3f ", arg_string, arg);
printf("%-7s%-16.3f ", format_argname(arg_string), arg);
}
static void
@ -201,12 +210,12 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
us = get_us_from_tsc(e->tsc - stats->start[e->object_id],
tsc_rate);
print_object_id(d->object_type, stats->index[e->object_id]);
print_float("time:", us);
print_float("time", us);
} else {
printf("id: N/A");
}
} else if (e->object_id != 0) {
print_arg(SPDK_TRACE_ARG_TYPE_PTR, "object: ", e->object_id);
print_arg(SPDK_TRACE_ARG_TYPE_PTR, "object", e->object_id);
}
printf("\n");
}

View File

@ -6932,7 +6932,7 @@ SPDK_TRACE_REGISTER_FN(bdev_trace, "bdev", TRACE_GROUP_BDEV)
spdk_trace_register_object(OBJECT_BDEV_IO, 'i');
spdk_trace_register_description("BDEV_IO_START", TRACE_BDEV_IO_START, OWNER_BDEV,
OBJECT_BDEV_IO, 1,
SPDK_TRACE_ARG_TYPE_INT, "type: ");
SPDK_TRACE_ARG_TYPE_INT, "type");
spdk_trace_register_description("BDEV_IO_DONE", TRACE_BDEV_IO_DONE, OWNER_BDEV,
OBJECT_BDEV_IO, 0,
SPDK_TRACE_ARG_TYPE_INT, "");

View File

@ -78,32 +78,32 @@ SPDK_TRACE_REGISTER_FN(blobfs_trace, "blobfs", TRACE_GROUP_BLOBFS)
TRACE_BLOBFS_XATTR_START,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
spdk_trace_register_description("BLOBFS_XATTR_END",
TRACE_BLOBFS_XATTR_END,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
spdk_trace_register_description("BLOBFS_OPEN",
TRACE_BLOBFS_OPEN,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
spdk_trace_register_description("BLOBFS_CLOSE",
TRACE_BLOBFS_CLOSE,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
spdk_trace_register_description("BLOBFS_DELETE_START",
TRACE_BLOBFS_DELETE_START,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
spdk_trace_register_description("BLOBFS_DELETE_DONE",
TRACE_BLOBFS_DELETE_DONE,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_STR,
"file: ");
"file");
}
void

View File

@ -90,92 +90,92 @@ SPDK_TRACE_REGISTER_FN(ftl_trace_func, "ftl", TRACE_GROUP_FTL)
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "band_defrag");
spdk_trace_register_description(descbuf, FTL_TRACE_BAND_DEFRAG(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "band: ");
SPDK_TRACE_ARG_TYPE_INT, "band");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "band_write");
spdk_trace_register_description(descbuf, FTL_TRACE_BAND_WRITE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "band: ");
SPDK_TRACE_ARG_TYPE_INT, "band");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "limits");
spdk_trace_register_description(descbuf, FTL_TRACE_LIMITS(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "limits: ");
SPDK_TRACE_ARG_TYPE_INT, "limits");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "rwb_pop");
spdk_trace_register_description(descbuf, FTL_TRACE_WBUF_POP(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_read_sched");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_READ_SCHEDULE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_read_submit");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_READ_SUBMISSION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_read_cmpl");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_READ_COMPLETION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_write_sched");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_WRITE_SCHEDULE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_write_submit");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_WRITE_SUBMISSION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "md_write_cmpl");
spdk_trace_register_description(descbuf, FTL_TRACE_MD_WRITE_COMPLETION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "read_sched");
spdk_trace_register_description(descbuf, FTL_TRACE_READ_SCHEDULE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "read_submit");
spdk_trace_register_description(descbuf, FTL_TRACE_READ_SUBMISSION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "read_cmpl_invld");
spdk_trace_register_description(descbuf, FTL_TRACE_READ_COMPLETION_INVALID(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "read_cmpl_cache");
spdk_trace_register_description(descbuf, FTL_TRACE_READ_COMPLETION_CACHE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "read_cmpl_ssd");
spdk_trace_register_description(descbuf, FTL_TRACE_READ_COMPLETION_DISK(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "write_sched");
spdk_trace_register_description(descbuf, FTL_TRACE_WRITE_SCHEDULE(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "rwb_fill");
spdk_trace_register_description(descbuf, FTL_TRACE_WRITE_WBUF_FILL(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "write_submit");
spdk_trace_register_description(descbuf, FTL_TRACE_WRITE_SUBMISSION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "write_cmpl");
spdk_trace_register_description(descbuf, FTL_TRACE_WRITE_COMPLETION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "lba: ");
SPDK_TRACE_ARG_TYPE_INT, "lba");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "erase_submit");
spdk_trace_register_description(descbuf, FTL_TRACE_ERASE_SUBMISSION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
snprintf(descbuf, sizeof(descbuf), "%c %s", source[i], "erase_cmpl");
spdk_trace_register_description(descbuf, FTL_TRACE_ERASE_COMPLETION(i),
OWNER_FTL, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "addr: ");
SPDK_TRACE_ARG_TYPE_INT, "addr");
}
}

View File

@ -1652,19 +1652,19 @@ SPDK_TRACE_REGISTER_FN(iscsi_conn_trace, "iscsi_conn", TRACE_GROUP_ISCSI)
SPDK_TRACE_ARG_TYPE_INT, "");
spdk_trace_register_description("ISCSI_WRITE_START", TRACE_ISCSI_FLUSH_WRITEBUF_START,
OWNER_ISCSI_CONN, OBJECT_ISCSI_PDU, 1,
SPDK_TRACE_ARG_TYPE_INT, "iovec: ");
SPDK_TRACE_ARG_TYPE_INT, "iovec");
spdk_trace_register_description("ISCSI_WRITE_DONE", TRACE_ISCSI_FLUSH_WRITEBUF_DONE,
OWNER_ISCSI_CONN, OBJECT_ISCSI_PDU, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
spdk_trace_register_description("ISCSI_READ_PDU", TRACE_ISCSI_READ_PDU,
OWNER_ISCSI_CONN, OBJECT_ISCSI_PDU, 1,
SPDK_TRACE_ARG_TYPE_INT, "opc: ");
SPDK_TRACE_ARG_TYPE_INT, "opc");
spdk_trace_register_description("ISCSI_TASK_DONE", TRACE_ISCSI_TASK_DONE,
OWNER_ISCSI_CONN, OBJECT_SCSI_TASK, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
spdk_trace_register_description("ISCSI_TASK_QUEUE", TRACE_ISCSI_TASK_QUEUE,
OWNER_ISCSI_CONN, OBJECT_SCSI_TASK, 1,
SPDK_TRACE_ARG_TYPE_PTR, "pdu: ");
SPDK_TRACE_ARG_TYPE_PTR, "pdu");
spdk_trace_register_description("ISCSI_TASK_EXECUTED", TRACE_ISCSI_TASK_EXECUTED,
OWNER_ISCSI_CONN, OBJECT_ISCSI_PDU, 0,
SPDK_TRACE_ARG_TYPE_INT, "");

View File

@ -159,63 +159,63 @@ 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", TRACE_RDMA_REQUEST_STATE_NEW,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 1,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_NEED_BUFFER", TRACE_RDMA_REQUEST_STATE_NEED_BUFFER,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_TX_PENDING_C2H",
TRACE_RDMA_REQUEST_STATE_DATA_TRANSFER_TO_HOST_PENDING,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_TX_PENDING_H2C",
TRACE_RDMA_REQUEST_STATE_DATA_TRANSFER_TO_CONTROLLER_PENDING,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_TX_H2C",
TRACE_RDMA_REQUEST_STATE_TRANSFERRING_HOST_TO_CONTROLLER,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_RDY_TO_EXECUTE",
TRACE_RDMA_REQUEST_STATE_READY_TO_EXECUTE,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_EXECUTING",
TRACE_RDMA_REQUEST_STATE_EXECUTING,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_EXECUTED",
TRACE_RDMA_REQUEST_STATE_EXECUTED,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_RDY_TO_COMPL",
TRACE_RDMA_REQUEST_STATE_READY_TO_COMPLETE,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_COMPLETING_C2H",
TRACE_RDMA_REQUEST_STATE_TRANSFERRING_CONTROLLER_TO_HOST,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_COMPLETING",
TRACE_RDMA_REQUEST_STATE_COMPLETING,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_REQ_COMPLETED",
TRACE_RDMA_REQUEST_STATE_COMPLETED,
OWNER_NONE, OBJECT_NVMF_RDMA_IO, 0,
SPDK_TRACE_ARG_TYPE_PTR, "qpair: ");
SPDK_TRACE_ARG_TYPE_PTR, "qpair");
spdk_trace_register_description("RDMA_QP_CREATE", TRACE_RDMA_QP_CREATE,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "");
spdk_trace_register_description("RDMA_IBV_ASYNC_EVENT", TRACE_RDMA_IBV_ASYNC_EVENT,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "type: ");
SPDK_TRACE_ARG_TYPE_INT, "type");
spdk_trace_register_description("RDMA_CM_ASYNC_EVENT", TRACE_RDMA_CM_ASYNC_EVENT,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "type: ");
SPDK_TRACE_ARG_TYPE_INT, "type");
spdk_trace_register_description("RDMA_QP_STATE_CHANGE", TRACE_RDMA_QP_STATE_CHANGE,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_PTR, "state: ");
SPDK_TRACE_ARG_TYPE_PTR, "state");
spdk_trace_register_description("RDMA_QP_DISCONNECT", TRACE_RDMA_QP_DISCONNECT,
OWNER_NONE, OBJECT_NONE, 0,
SPDK_TRACE_ARG_TYPE_INT, "");