Lines Matching defs:std
58 const std::string LOG_FILE_PATH = "data/log/eventlog";
60 std::shared_ptr<AppfreezeManager> AppfreezeManager::instance_ = nullptr;
64 std::map<int, std::string> AppfreezeManager::catchStackMap_;
69 name_ = "AppfreezeManager" + std::to_string(GetMilliseconds());
76 std::shared_ptr<AppfreezeManager> AppfreezeManager::GetInstance()
79 std::lock_guard<ffrt::mutex> lock(singletonMutex_);
81 instance_ = std::make_shared<AppfreezeManager>();
89 std::lock_guard<ffrt::mutex> lock(singletonMutex_);
98 auto now = std::chrono::system_clock::now();
99 auto millisecs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
103 bool AppfreezeManager::IsHandleAppfreeze(const std::string& bundleName)
120 std::string memoryContent = "";
130 void AppfreezeManager::CollectFreezeSysMemory(std::string& memoryContent)
132 std::string tmp = "";
133 std::string pressMemInfo = "/proc/pressure/memory";
136 std::string memInfoPath = "/proc/memview";
169 std::string memoryContent = "";
171 std::string fileName = faultData.errorObject.name + "_" +
172 AbilityRuntime::TimeUtil::FormatTime("%Y%m%d%H%M%S") + "_" + std::to_string(appInfo.pid) + "_stack";
173 std::string catcherStack = "";
174 std::string catchJsonStack = "";
175 std::string fullStackPath = "";
183 std::string timeStamp = "\nTimestamp:" + AbilityRuntime::TimeUtil::FormatTime("%Y-%m-%d %H:%M:%S") +
184 ":" + std::to_string(start % SEC_TO_MILLISEC);
198 std::string AppfreezeManager::WriteToFile(const std::string& fileName, std::string& content)
200 std::string dir_path = LOG_FILE_PATH + "/freeze";
206 std::string realPath;
211 std::string stackPath = realPath + "/" + fileName;
246 std::to_string(info.pid) +
247 "-" + std::to_string(GetMilliseconds());
258 const AppfreezeManager::AppInfo& appInfo, const std::string& memoryContent)
268 std::string binderInfo;
269 std::string binderPidsStr;
270 std::set<int> pids = GetBinderPeerPids(binderInfo, pid);
274 std::string content = "PeerBinder catcher stacktrace for pid : " + std::to_string(pidTemp) + "\n";
277 binderPidsStr += " " + std::to_string(pidTemp);
285 std::string fileName = faultData.errorObject.name + "_" +
286 AbilityRuntime::TimeUtil::FormatTime("%Y%m%d%H%M%S") + "_" + std::to_string(appInfo.pid) + "_binder";
287 std::string fullStackPath = WriteToFile(fileName, binderInfo);
295 const std::string& binderInfo, const std::string& memoryContent)
297 std::string appRunningUniqueId = "";
323 std::map<int, std::set<int>> AppfreezeManager::BinderParser(std::ifstream& fin, std::string& stack) const
325 std::map<int, std::set<int>> binderInfo;
327 std::string line;
337 if (line.find("async\t") != std::string::npos) {
341 std::istringstream lineStream(line);
342 std::vector<std::string> strList;
343 std::string tmpstr;
348 auto SplitPhase = [](const std::string& str, uint16_t index) -> std::string {
349 std::vector<std::string> strings;
359 std::string server = SplitPhase(strList[2], 0);
361 std::string client = SplitPhase(strList[0], 0);
363 std::string wait = SplitPhase(strList[5], 1);
367 int serverNum = std::strtol(server.c_str(), nullptr, decimal);
368 int clientNum = std::strtol(client.c_str(), nullptr, decimal);
369 int waitNum = std::strtol(wait.c_str(), nullptr, decimal);
382 std::set<int> AppfreezeManager::GetBinderPeerPids(std::string& stack, int pid) const
384 std::set<int> pids;
385 std::ifstream fin;
386 std::string path = LOGGER_DEBUG_PROC_PATH;
399 stack += "\n\nPeerBinderCatcher -- pid==" + std::to_string(pid) + "\n\n";
400 std::map<int, std::set<int>> binderInfo = BinderParser(fin, stack);
414 void AppfreezeManager::ParseBinderPids(const std::map<int, std::set<int>>& binderInfo,
415 std::set<int>& pids, int pid, int layer) const
432 std::lock_guard<ffrt::mutex> lock(catchStackMutex_);
439 void AppfreezeManager::FindStackByPid(std::string& ret, int pid) const
441 std::lock_guard<ffrt::mutex> lock(catchStackMutex_);
448 std::string AppfreezeManager::CatchJsonStacktrace(int pid, const std::string& faultType) const
452 std::string ret;
453 std::string msg;
457 ret = "Failed to dump stacktrace for " + std::to_string(pid) + "\n" + msg;
464 std::lock_guard<ffrt::mutex> lock(catchStackMutex_);
471 std::string AppfreezeManager::CatcherStacktrace(int pid) const
475 std::string ret;
476 std::string msg;
478 ret = "Failed to dump stacktrace for " + std::to_string(pid) + "\n" + msg;
485 bool AppfreezeManager::IsProcessDebug(int32_t pid, std::string bundleName)
487 std::lock_guard<ffrt::mutex> lock(freezeFilterMutex_);
502 std::string debugBundle(paramBundle);
523 std::lock_guard<ffrt::mutex> lock(freezeMutex_);
538 std::lock_guard<ffrt::mutex> lock(freezeMutex_);
548 std::lock_guard<ffrt::mutex> lock(freezeMutex_);
558 std::lock_guard<ffrt::mutex> lock(freezeMutex_);
597 bool AppfreezeManager::CancelAppFreezeDetect(int32_t pid, const std::string& bundleName)
603 std::lock_guard<ffrt::mutex> lock(freezeFilterMutex_);
611 void AppfreezeManager::RemoveDeathProcess(std::string bundleName)
613 std::lock_guard<ffrt::mutex> lock(freezeFilterMutex_);
621 void AppfreezeManager::ResetAppfreezeState(int32_t pid, const std::string& bundleName)
623 std::lock_guard<ffrt::mutex> lock(freezeFilterMutex_);
631 bool AppfreezeManager::IsValidFreezeFilter(int32_t pid, const std::string& bundleName)
633 std::lock_guard<ffrt::mutex> lock(freezeFilterMutex_);