Commit 753e344f authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Tomasz Zawadzki
Browse files

app/trace: fix for trace_print()



This patch fixes issue introduced in patch 22642.

If lcore is defined in trace_print() and initialized with
SPDK_TRACE_MAX_LCORE, the 'if' statement inside 'for'
loop is always true and trace size is printed for
every lcore. This is not intended use of this
function - if the user passes the lcore number
as a command line parameter, only this lcore shall
be printed. We need to propagate lcore number from
main(), where it is parsed and assigned, to the
trace_print().

Change-Id: I5c84da7da7df39c88ac52ba4ffaea8a518de77c6
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22829


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent eab6884c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -321,10 +321,9 @@ print_json(void *cb_ctx, const void *data, size_t size)
}

static int
trace_print(void)
trace_print(int lcore)
{
	struct spdk_trace_parser_entry	entry;
	int		lcore = SPDK_TRACE_MAX_LCORE;
	int		i;
	uint64_t	tsc_offset, entry_count;
	uint64_t	tsc_rate = g_file->tsc_rate;
@@ -518,7 +517,7 @@ main(int argc, char **argv)
		break;
	case PRINT_FMT_DEFAULT:
	default:
		rc = trace_print();
		rc = trace_print(lcore);
		break;
	}