From 7ca411339c4d56c9e2bf6642b996d9dbfbf9e821 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Tue, 18 May 2021 10:46:49 +0200 Subject: [PATCH] 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 Change-Id: I5199a3219a31d6afd3178324a4f48563b84e6149 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7958 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- app/trace/trace.cpp | 16 ++++++---------- lib/trace/trace_flags.c | 2 +- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/app/trace/trace.cpp b/app/trace/trace.cpp index 8d0f4920f..2444d1344 100644 --- a/app/trace/trace.cpp +++ b/app/trace/trace.cpp @@ -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"); } diff --git a/lib/trace/trace_flags.c b/lib/trace/trace_flags.c index 8faf135a5..ec4845a7d 100644 --- a/lib/trace/trace_flags.c +++ b/lib/trace/trace_flags.c @@ -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; }