spdk_trace: improve formatting

This ensures the per-event arguments are always lined
up in the output.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I89ccc10e5ab5653562d598f7c0e5bf495becdf01

Reviewed-on: https://review.gerrithub.io/424281
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-08-31 14:51:23 -07:00 committed by Ben Walker
parent 8bcbe397c1
commit aa37b4f9d5

View File

@ -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");
}