trace: add an assert for the valid history

Change-Id: I4dd97351354af8ccdd0684afda06e6f2e8889839
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9828
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
GangCao 2021-10-12 10:37:58 -04:00 committed by Tomasz Zawadzki
parent fa36884a78
commit e9030f36bc

View File

@ -342,6 +342,7 @@ spdk_trace_parser::init(const spdk_trace_parser_opts *opts)
if (opts->lcore == SPDK_TRACE_MAX_LCORE) {
for (i = 0; i < SPDK_TRACE_MAX_LCORE; i++) {
history = spdk_get_per_lcore_history(_histories, i);
assert(history);
if (history->num_entries == 0 || history->entries[0].tsc == 0) {
continue;
}
@ -350,6 +351,7 @@ spdk_trace_parser::init(const spdk_trace_parser_opts *opts)
}
} else {
history = spdk_get_per_lcore_history(_histories, opts->lcore);
assert(history);
if (history->num_entries > 0 && history->entries[0].tsc != 0) {
populate_events(history, history->num_entries);
}