From 2f473b916b7a00c225ef4cca7166e12a80395d3c Mon Sep 17 00:00:00 2001 From: leishaogang Date: Thu, 11 Jul 2024 14:12:43 +0800 Subject: [PATCH] fix raw trace cpuId more than max Signed-off-by: leishaogang --- trace_streamer/src/base/file.h | 2 +- .../src/parser/rawtrace_parser/cpu_detail_parser.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/trace_streamer/src/base/file.h b/trace_streamer/src/base/file.h index 931fc18e..9f5eedb7 100644 --- a/trace_streamer/src/base/file.h +++ b/trace_streamer/src/base/file.h @@ -43,7 +43,7 @@ int32_t OpenFile(const std::string &path, int32_t flags, uint32_t mode = K_FILE_ std::string GetExecutionDirectoryPath(); #ifdef is_linux -std::vector GetFilesNameFromDir(const std::string &fileDir); +std::vector GetFilesNameFromDir(const std::string &path); #endif } // namespace base } // namespace SysTuning diff --git a/trace_streamer/src/parser/rawtrace_parser/cpu_detail_parser.cpp b/trace_streamer/src/parser/rawtrace_parser/cpu_detail_parser.cpp index 527e7a42..8af52df4 100644 --- a/trace_streamer/src/parser/rawtrace_parser/cpu_detail_parser.cpp +++ b/trace_streamer/src/parser/rawtrace_parser/cpu_detail_parser.cpp @@ -156,6 +156,10 @@ void CpuDetailParser::VoltageEventInitialization() } void CpuDetailParser::EventAppend(std::shared_ptr event) { + if (event->cpuId >= standAloneCpuEventList_.size()) { + TS_LOGW("cpuId: %u is invailed", event->cpuId); + return; + } standAloneCpuEventList_[event->cpuId].emplace(std::move(event)); curRawTraceEventNum_++; } -- Gitee