From aa37b4f9d56977761bccbcf67a92d465231f5013 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 31 Aug 2018 14:51:23 -0700 Subject: [PATCH] spdk_trace: improve formatting This ensures the per-event arguments are always lined up in the output. Signed-off-by: Jim Harris Change-Id: I89ccc10e5ab5653562d598f7c0e5bf495becdf01 Reviewed-on: https://review.gerrithub.io/424281 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- app/trace/trace.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/trace/trace.cpp b/app/trace/trace.cpp index 6efe912e6..a6f94e0c3 100644 --- a/app/trace/trace.cpp +++ b/app/trace/trace.cpp @@ -136,6 +136,7 @@ static void print_arg(bool arg_is_ptr, const char *arg_string, uint64_t arg) { if (arg_string[0] == 0) { + printf("%24s", ""); return; } @@ -182,8 +183,8 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate, printf("%-*s ", (int)sizeof(d->name), d->name); print_size(e->size); + print_arg(d->arg1_is_ptr, d->arg1_name, e->arg1); if (d->new_object) { - print_arg(d->arg1_is_ptr, d->arg1_name, e->arg1); print_object_id(d->object_type, stats->index[e->object_id]); } else if (d->object_type != OBJECT_NONE) { if (stats->start.find(e->object_id) != stats->start.end()) { @@ -200,8 +201,6 @@ print_event(struct spdk_trace_entry *e, uint64_t tsc_rate, } else { printf("id: N/A"); } - } else { - print_arg(d->arg1_is_ptr, d->arg1_name, e->arg1); } printf("\n"); }