修改editor采集过程中打开device帧率异常问题

Signed-off-by: frank-huangran <frank.huangran@huawei.com>
This commit is contained in:
frank-huangran 2024-11-18 15:38:36 +08:00
parent 116dc9a58e
commit 06c2ffaa86
3 changed files with 10 additions and 5 deletions

View File

@ -29,6 +29,7 @@ public:
static void SetByTrace(std::string message);
static SpProfiler *GetCmdProfilerItem(CommandType commandType, bool cmdFlag);
static SpProfiler *GetCmdProfilerItemContinue(CommandType commandType, bool cmdFlag);
static inline bool editorFlag = false;
};
}
}

View File

@ -395,11 +395,13 @@ public:
if (retCode.find("smartperf") != std::string::npos) {
OHOS::SmartPerf::Dubai::dubaiPkgName = retCode;
}
std::string processId = "";
OHOS::SmartPerf::StartUpDelay sp;
processId = sp.GetPidByPkg(retCode);
SpProfilerFactory::SetProfilerPidByPkg(processId);
SpProfilerFactory::SetProfilerPkg(retCode);
if (!SpProfilerFactory::editorFlag) {
std::string processId = "";
OHOS::SmartPerf::StartUpDelay sp;
processId = sp.GetPidByPkg(retCode);
SpProfilerFactory::SetProfilerPidByPkg(processId);
SpProfilerFactory::SetProfilerPkg(retCode);
}
spSocket.Sendto(retCode);
} else if (iterator->first == MessageType::FPS_STOP) {
spSocket.Sendto(resultFPS);

View File

@ -335,6 +335,7 @@ void SPTask::AsyncGetDataMap(std::function<void(std::string data)> msgTask)
asyncDataMtx.lock();
std::map<std::string, std::string> dataMap;
if (!curTaskInfo.packageName.empty()) {
SpProfilerFactory::editorFlag = true;
std::string processId = "";
OHOS::SmartPerf::StartUpDelay sp;
processId = sp.GetPidByPkg(curTaskInfo.packageName);
@ -480,6 +481,7 @@ ErrCode SPTask::StopTask()
thread.join();
}
KillHiperfCmd();
SpProfilerFactory::editorFlag = false;
return ErrCode::OK;
}