Commit 1468f8dd authored by Xiaodong Liu's avatar Xiaodong Liu Committed by Changpeng Liu
Browse files

app/trace: check num_entries before referring



For trace file which is generated by spdk trace_record,
if one lcore recorded no entries, there is no space for
it to have idle entries to referring.

Change-Id: I1cd89ec934407fc805bda66c8c87f76cb181679e
Signed-off-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449840


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 0c41a7ce
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ int main(int argc, char **argv)
	if (lcore == SPDK_TRACE_MAX_LCORE) {
		for (i = 0; i < SPDK_TRACE_MAX_LCORE; i++) {
			history = spdk_get_per_lcore_history(g_histories, i);
			if (history->entries[0].tsc == 0) {
			if (history->num_entries == 0 || history->entries[0].tsc == 0) {
				continue;
			}

@@ -423,7 +423,7 @@ int main(int argc, char **argv)
		}
	} else {
		history = spdk_get_per_lcore_history(g_histories, lcore);
		if (history->entries[0].tsc != 0) {
		if (history->num_entries > 0 && history->entries[0].tsc != 0) {
			if (g_verbose && history->num_entries) {
				printf("Trace Size of lcore (%d): %ju\n", lcore, history->num_entries);
			}