diff --git a/ide/src/trace/component/SpFlags.ts b/ide/src/trace/component/SpFlags.ts index d50ac6e715acb79355f6e93e382aca4abfb77881..2b4c86d0968a51fca56626a9b7dd92b2dab291a2 100644 --- a/ide/src/trace/component/SpFlags.ts +++ b/ide/src/trace/component/SpFlags.ts @@ -254,6 +254,11 @@ export class FlagsConfig { switchOptions: [{ option: 'Enabled' }, { option: 'Disabled', selected: true }], describeContent: 'The real CPU after being split by irq and softirq', }, + { + title: 'RawTraceCutStartTs', + switchOptions: [{ option: 'Enabled', selected: true }, { option: 'Disabled' }], + describeContent: 'Raw Trace Cut By StartTs, StartTs = Max(Cpu1 StartTs, Cpu2 StartTs, ..., CpuN StartTs)', + }, ]; static getAllFlagConfig(): Array { diff --git a/trace_streamer/src/filter/cpu_filter.cpp b/trace_streamer/src/filter/cpu_filter.cpp index 3a0611907f53302548aea5d062644ae890b5b5fb..a280fcb8064b17e969db4adbd36d5e2eb02cc2e2 100644 --- a/trace_streamer/src/filter/cpu_filter.cpp +++ b/trace_streamer/src/filter/cpu_filter.cpp @@ -94,6 +94,10 @@ void CpuFilter::ProcPrevPidSwitchEvent(uint64_t ts, } else { pidToThreadSliceRow_.at(prevPid) = threadStateRow; } + } else { + if (pidToThreadSliceRow_.count(prevPid)) { + pidToThreadSliceRow_.erase(prevPid); + } } (void)RemberInternalTidInStateTable(prevPid, threadStateRow, prevState); } diff --git a/trace_streamer/src/parser/pbreader_parser/mem_parser/pbreader_mem_parser.cpp b/trace_streamer/src/parser/pbreader_parser/mem_parser/pbreader_mem_parser.cpp index 0457bedf6b1bec0e841de1c1ba58c6000ff7ea2e..0f4ad0405d9bbf05047cf3dcc855daff2e6f0db9 100644 --- a/trace_streamer/src/parser/pbreader_parser/mem_parser/pbreader_mem_parser.cpp +++ b/trace_streamer/src/parser/pbreader_parser/mem_parser/pbreader_mem_parser.cpp @@ -592,6 +592,7 @@ void PbreaderMemParser::FillGpuWindowMemInfo(const ProtoReader::GpuDumpInfo_Read { DataIndex windowNameId = traceDataCache_->GetDataIndex(gpuDumpInfo.window_name().ToStdString()); GpuWindowMemRow row; + row.windowNameId = windowNameId; row.ts = timeStamp; row.windowId = gpuDumpInfo.id(); row.purgeableSize = gpuDumpInfo.gpu_purgeable_size(); diff --git a/trace_streamer/src/parser/print_event_parser.h b/trace_streamer/src/parser/print_event_parser.h index 6b26d035a2c95b7611864302666c7338d9ea418c..c97da532f739fafedbe50e075beea9a11d46a8ed 100644 --- a/trace_streamer/src/parser/print_event_parser.h +++ b/trace_streamer/src/parser/print_event_parser.h @@ -92,7 +92,7 @@ private: const std::string onAnimationProcEvent_ = "render_service"; const DataIndex marshRwTransactionData_ = traceDataCache_->GetDataIndex("H:MarshRSTransactionData"); const DataIndex rsMainThreadProcessCmd_ = traceDataCache_->GetDataIndex("H:RSMainThread::ProcessCommandUni"); - const std::regex recvVsyncPattern_ = std::regex("(\\w+):(\\w+)"); + const std::regex recvVsyncPattern_ = std::regex(R"((\w+):\s*(\w+))"); const std::regex transFlagPattern_ = std::regex("transactionFlag:\\[(\\d+),(\\d+)\\]"); const std::regex mainProcessCmdPattern_ = std::regex("\\[(\\d+),(\\d+)\\]"); const std::regex distributeMatcher_ = std::regex(R"(H:\[([a-z0-9]+),([a-z0-9]+),([a-z0-9]+)\]#([CS]?)##(.*))"); diff --git a/trace_streamer/src/parser/rawtrace_parser/ftrace_event_processor.cpp b/trace_streamer/src/parser/rawtrace_parser/ftrace_event_processor.cpp index 58e0c9c5f369da1d4eae8c94da061798c4d5b823..a7ef062e1d2299d16c0718c9d947a72824d4465c 100644 --- a/trace_streamer/src/parser/rawtrace_parser/ftrace_event_processor.cpp +++ b/trace_streamer/src/parser/rawtrace_parser/ftrace_event_processor.cpp @@ -434,8 +434,8 @@ bool FtraceEventProcessor::TracingMarkWriteOrPrintFormat(FtraceEvent &ftraceEven if (format.eventId < HM_EVENT_ID_OFFSET) { printMsg->set_ip(FtraceFieldProcessor::HandleIntField(format.fields, index++, data, size)); } - // size大于60时为适配内核的event,小于则为原始的event - if (format.eventSize > 60) { + // size大于20时为适配内核的event,小于则为原始的event + if (format.eventSize > 20) { auto pid = FtraceFieldProcessor::HandleIntField(format.fields, index++, data, size); auto name = FtraceFieldProcessor::HandleStrField(format.fields, index++, data, size); auto start = FtraceFieldProcessor::HandleIntField(format.fields, index++, data, size); diff --git a/trace_streamer/src/parser/rawtrace_parser/rawtrace_parser.cpp b/trace_streamer/src/parser/rawtrace_parser/rawtrace_parser.cpp index 32d8b31f9e373da84d73ac0c25b3381ea991fcd8..0459ccdb48de9f145e74fe707da34569dff8bb05 100644 --- a/trace_streamer/src/parser/rawtrace_parser/rawtrace_parser.cpp +++ b/trace_streamer/src/parser/rawtrace_parser/rawtrace_parser.cpp @@ -46,6 +46,9 @@ void RawTraceParser::WaitForParserEnd() } void RawTraceParser::UpdateTraceMinRange() { + if (!traceDataCache_->RawTraceCutStartTsEnabled()) { + return; + } auto schedSlice = traceDataCache_->GetConstSchedSliceData(); std::set uniqueCpuIdSet; uint64_t cpuRunningStatMinTime = INVALID_TIME; diff --git a/trace_streamer/src/rpc/rpc_server.cpp b/trace_streamer/src/rpc/rpc_server.cpp index 34aa13d7c0f33771c419add340b9f779b950aeff..82f5bbe31a5852b5b0a9620a93e546e732036d92 100644 --- a/trace_streamer/src/rpc/rpc_server.cpp +++ b/trace_streamer/src/rpc/rpc_server.cpp @@ -54,6 +54,7 @@ struct ParserConfig { int32_t binderConfigValue; int32_t ffrtConvertConfigValue; int32_t HMKernelConfigValue; + int32_t rawTraceCutStartTsValue; }; void from_json(const json &j, ParserConfig &v) { @@ -63,6 +64,9 @@ void from_json(const json &j, ParserConfig &v) j.at("BinderRunnable").get_to(v.binderConfigValue); j.at("FfrtConvert").get_to(v.ffrtConvertConfigValue); j.at("HMKernel").get_to(v.HMKernelConfigValue); + if (j.contains("RawTraceCutStartTs")) { + v.rawTraceCutStartTsValue = j.at("RawTraceCutStartTs"); + } } } // namespace jsonns #if IS_WASM @@ -768,6 +772,7 @@ bool RpcServer::ParserConfig(std::string parserConfigJson) ts_->UpdateTaskPoolTraceStatus(parserConfig.taskConfigValue); ts_->UpdateBinderRunnableTraceStatus(parserConfig.binderConfigValue); ts_->UpdateHMKernelTraceStatus(parserConfig.HMKernelConfigValue); + ts_->UpdateRawTraceCutStartTsStatus(parserConfig.rawTraceCutStartTsValue); ffrtConvertEnabled_ = parserConfig.ffrtConvertConfigValue; startParseTime_ = (std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch())) diff --git a/trace_streamer/src/trace_data/trace_data_cache.cpp b/trace_streamer/src/trace_data/trace_data_cache.cpp index 78b8a3b52c35e7918657b64e69da55944c509a1c..ee159f361dff26801e8e79a1bea458b9792f8e13 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.cpp +++ b/trace_streamer/src/trace_data/trace_data_cache.cpp @@ -287,11 +287,18 @@ bool TraceDataCache::HMKernelTraceEnabled() const { return HMKernelTraceEnabled_; } - void TraceDataCache::UpdateHMKernelTraceStatus(bool status) { HMKernelTraceEnabled_ = status; } +bool TraceDataCache::RawTraceCutStartTsEnabled() const +{ + return rawTraceCutStartTsEnabled_; +} +void TraceDataCache::UpdateRawTraceCutStartTsStatus(bool status) +{ + rawTraceCutStartTsEnabled_ = status; +} uint64_t TraceDataCache::SplitFileMaxTime() { return splitFileMaxTs_; diff --git a/trace_streamer/src/trace_data/trace_data_cache.h b/trace_streamer/src/trace_data/trace_data_cache.h index 0d2d7ee6e977e24ab19d03282759955e89b08ba0..7cbdcf9135f0bb04ae48da19dce6ddd0b855e05f 100644 --- a/trace_streamer/src/trace_data/trace_data_cache.h +++ b/trace_streamer/src/trace_data/trace_data_cache.h @@ -41,6 +41,8 @@ public: void UpdateBinderRunnableTraceStatus(bool status); bool HMKernelTraceEnabled() const; void UpdateHMKernelTraceStatus(bool status); + bool RawTraceCutStartTsEnabled() const; + void UpdateRawTraceCutStartTsStatus(bool status); uint64_t SplitFileMaxTime(); uint64_t SplitFileMinTime(); void SetSplitFileMaxTime(uint64_t maxTs); @@ -88,6 +90,7 @@ private: bool appStartTraceEnabled_ = false; bool binderRunnableTraceEnabled_ = false; bool HMKernelTraceEnabled_ = false; + bool rawTraceCutStartTsEnabled_ = true; uint64_t splitFileMinTs_ = INVALID_UINT64; uint64_t splitFileMaxTs_ = INVALID_UINT64; std::deque> hookCommProtos_; diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp index 6d8aab3fe947f524aa432449f0529f80da75af00..d747e9682a1a9a39132889685a59e1f3a8dfc68e 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.cpp @@ -518,6 +518,10 @@ void TraceStreamerSelector::UpdateHMKernelTraceStatus(bool status) { traceDataCache_->UpdateHMKernelTraceStatus(status); } +void TraceStreamerSelector::UpdateRawTraceCutStartTsStatus(bool status) +{ + traceDataCache_->UpdateRawTraceCutStartTsStatus(status); +} bool TraceStreamerSelector::LoadQueryFile(const std::string &sqlOperator, std::vector &sqlStrings) { std::ifstream file(sqlOperator); diff --git a/trace_streamer/src/trace_streamer/trace_streamer_selector.h b/trace_streamer/src/trace_streamer/trace_streamer_selector.h index c34ba72465fec415086945ac9948cb6c686d7bd0..e00974571475caf790ff211978fca33f0539718a 100644 --- a/trace_streamer/src/trace_streamer/trace_streamer_selector.h +++ b/trace_streamer/src/trace_streamer/trace_streamer_selector.h @@ -65,6 +65,7 @@ public: void UpdateAppStartTraceStatus(bool status); void UpdateBinderRunnableTraceStatus(bool status); void UpdateHMKernelTraceStatus(bool status); + void UpdateRawTraceCutStartTsStatus(bool status); void InitMetricsMap(std::map &metricsMap); const std::string MetricsSqlQuery(const std::string &metrics); auto GetPtreaderParser()