mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2025-02-18 17:59:06 +00:00
commit
c395248b99
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user