Commit 7ca41133 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Jim Harris
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I5199a3219a31d6afd3178324a4f48563b84e6149
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7958


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 3e158bd5
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -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");
}

+1 −1
Original line number Diff line number Diff line
@@ -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;
		}