app/trace: print tpoint arguments at the end of a line

Now that each tracepoint can have more than one argument, we cannot pad
the missing ones, as it would take too much space.  Therefore, we put
them at the end of a line and simply skip the missing ones.

Additionally, since empty arguments are no longer padded, this patch
stops recording arguments with names consisting of an empty string
(containing just '\0').

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I5199a3219a31d6afd3178324a4f48563b84e6149
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7958
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-05-18 10:46:49 +02:00 committed by Jim Harris
parent 3e158bd5c9
commit 7ca411339c
2 changed files with 7 additions and 11 deletions

View File

@ -152,11 +152,6 @@ print_arg(uint8_t arg_type, const char *arg_string, const void *arg)
{
uint64_t value;
if (arg_string[0] == 0) {
printf("%24s", "");
return;
}
switch (arg_type) {
case SPDK_TRACE_ARG_TYPE_PTR:
memcpy(&value, arg, sizeof(value));
@ -206,11 +201,6 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
printf("%-*s ", (int)sizeof(d->name), d->name);
print_size(e->size);
for (i = 0, offset = 0; i < d->num_args; ++i) {
assert(offset < sizeof(e->args));
print_arg(d->args[i].type, d->args[i].name, &e->args[offset]);
offset += d->args[i].size;
}
if (d->new_object) {
print_object_id(d->object_type, stats->index[e->object_id]);
} else if (d->object_type != OBJECT_NONE) {
@ -225,6 +215,12 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate,
} else if (e->object_id != 0) {
print_arg(SPDK_TRACE_ARG_TYPE_PTR, "object", &e->object_id);
}
for (i = 0, offset = 0; i < d->num_args; ++i) {
assert(offset < sizeof(e->args));
print_arg(d->args[i].type, d->args[i].name, &e->args[offset]);
offset += d->args[i].size;
}
printf("\n");
}

View File

@ -303,7 +303,7 @@ trace_register_description(const struct spdk_trace_tpoint_opts *opts)
remaining_size = sizeof(((struct spdk_trace_entry *)0)->args);
for (i = 0; i < SPDK_TRACE_MAX_ARGS_COUNT; ++i) {
if (!opts->args[i].name) {
if (!opts->args[i].name || opts->args[i].name[0] == '\0') {
break;
}