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: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449840 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
0c41a7ce95
commit
1468f8dd3b
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user