!1678 清理告警

Merge pull request !1678 from wanglu/master
This commit is contained in:
openharmony_ci 2024-06-26 12:33:48 +00:00 committed by hhl
commit c395248b99
2 changed files with 23 additions and 9 deletions

View File

@ -223,7 +223,7 @@ std::optional<SysMemory> HidebugNativeInterfaceImpl::GetSystemMemInfo()
int HidebugNativeInterfaceImpl::GetMemoryLeakResource(const std::string& type,
int32_t value, bool enabledDebugLog)
{
HILOG_INFO(LOG_CORE, "GetMemoryLeakResource");
HILOG_DEBUG(LOG_CORE, "GetMemoryLeakResource");
auto memoryCollect = UCollectClient::MemoryCollector::Create();
if (!memoryCollect) {
HILOG_ERROR(LOG_CORE, "GetMemoryLeakResource Failed, return result");
@ -240,7 +240,7 @@ int HidebugNativeInterfaceImpl::GetMemoryLeakResource(const std::string& type,
static_cast<int>(result.retCode));
return MemoryState::MEMORY_FAILED;
}
HILOG_INFO(LOG_CORE, "GetMemoryLeakResource Success, retCode: %{public}d", static_cast<int>(result.retCode));
HILOG_DEBUG(LOG_CORE, "GetMemoryLeakResource Success, retCode: %{public}d", static_cast<int>(result.retCode));
return MemoryState::MEMORY_SUCCESS;
}

View File

@ -85,20 +85,34 @@ void Capture::ThreadGetCatchSocket(const std::string &curTime) const
if (curTime.empty()) {
return;
}
auto savePath = "/data/local/tmp/capture/screenCap_" + curTime + ".jpeg";
std::string captureDir = "/data/local/tmp/capture";
std::string savePath = captureDir + "/screenCap_" + curTime + ".jpeg";
std::string cmdResult;
if (!SPUtils::FileAccess("/data/local/tmp/capture")) {
SPUtils::LoadCmd("mkdir /data/local/tmp/capture", cmdResult);
printf("/data/local/tmp/capture created! \n");
LOGI("/data/local/tmp/capture created!");
if (!SPUtils::FileAccess(captureDir)) {
if (!SPUtils::LoadCmd("mkdir -p " + captureDir, cmdResult)) {
LOGI("%s capture not be created!", captureDir.c_str());
return;
} else {
LOGI("%s created successfully!", captureDir.c_str());
}
};
if (SPUtils::FileAccess(savePath)) {
std::cout << "" << std::endl;
LOGI("%s savePath already exists", savePath.c_str());
}
auto fd = open(savePath.c_str(), O_RDWR | O_CREAT, 0644);
SPUtils::LoadCmd("snapshot_display -f " + savePath, cmdResult);
(void)close(fd);
if (fd == -1) {
printf("Failed to open file: %s\n", savePath.c_str());
LOGI("Failed to open file: %s", savePath.c_str());
}
if (!SPUtils::LoadCmd("snapshot_display -f " + savePath, cmdResult)) {
LOGI("snapshot_display command failed!");
close(fd);
return;
}
close(fd);
}
void Capture::TriggerGetCatch(long long curTime) const