mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2024-11-23 06:50:12 +00:00
!1935 修复native daemon线程不安全问题
Merge pull request !1935 from zhangyixin/master
This commit is contained in:
commit
b73d9f0a5d
@ -69,6 +69,11 @@ public:
|
|||||||
std::shared_ptr<RawStack> GetRawStack();
|
std::shared_ptr<RawStack> GetRawStack();
|
||||||
void ReturnRawStack(std::shared_ptr<RawStack> rawStack);
|
void ReturnRawStack(std::shared_ptr<RawStack> rawStack);
|
||||||
size_t Size();
|
size_t Size();
|
||||||
|
void ClearCache()
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> lock(cacheMutex_);
|
||||||
|
rawDataCacheQueue_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex mutex_;
|
std::mutex mutex_;
|
||||||
|
@ -536,6 +536,7 @@ void HookManager::ReadShareMemory(const std::shared_ptr<HookManagerCtx>& hookCtx
|
|||||||
reinterpret_cast<char*>(rawStack->data));
|
reinterpret_cast<char*>(rawStack->data));
|
||||||
continue;
|
continue;
|
||||||
} else if (rawStack->stackConext->type == END_MSG) {
|
} else if (rawStack->stackConext->type == END_MSG) {
|
||||||
|
hookCtx->FlushStackArray();
|
||||||
if (!hookCtx->stackData->PutRawStack(rawStack, hookCtx->isRecordAccurately)) {
|
if (!hookCtx->stackData->PutRawStack(rawStack, hookCtx->isRecordAccurately)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -569,6 +570,9 @@ bool HookManager::DestroyPluginSession(const std::vector<uint32_t>& pluginIds)
|
|||||||
if (item->shareMemoryBlock != nullptr) {
|
if (item->shareMemoryBlock != nullptr) {
|
||||||
ShareMemoryAllocator::GetInstance().ReleaseMemoryBlockLocal(item->smbName);
|
ShareMemoryAllocator::GetInstance().ReleaseMemoryBlockLocal(item->smbName);
|
||||||
}
|
}
|
||||||
|
if (item->stackData != nullptr) {
|
||||||
|
item->stackData->ClearCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fpHookData_) {
|
if (fpHookData_) {
|
||||||
fclose(fpHookData_);
|
fclose(fpHookData_);
|
||||||
@ -615,7 +619,6 @@ bool HookManager::StopPluginSession(const std::vector<uint32_t>& pluginIds)
|
|||||||
} else {
|
} else {
|
||||||
PROFILER_LOG_INFO(LOG_CORE, "StopPluginSession: pid(%d) is less or equal zero.", item->pid);
|
PROFILER_LOG_INFO(LOG_CORE, "StopPluginSession: pid(%d) is less or equal zero.", item->pid);
|
||||||
}
|
}
|
||||||
item->FlushStackArray();
|
|
||||||
CHECK_TRUE(item->stackPreprocess != nullptr, false, "stop StackPreprocess FAIL");
|
CHECK_TRUE(item->stackPreprocess != nullptr, false, "stop StackPreprocess FAIL");
|
||||||
item->stackPreprocess->StopTakeResults();
|
item->stackPreprocess->StopTakeResults();
|
||||||
PROFILER_LOG_INFO(LOG_CORE, "StopTakeResults success");
|
PROFILER_LOG_INFO(LOG_CORE, "StopTakeResults success");
|
||||||
|
@ -49,7 +49,6 @@ void StackDataRepeater::Close()
|
|||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(mutex_);
|
std::unique_lock<std::mutex> lock(mutex_);
|
||||||
rawDataQueue_.clear();
|
rawDataQueue_.clear();
|
||||||
rawDataCacheQueue_.clear();
|
|
||||||
closed_ = true;
|
closed_ = true;
|
||||||
}
|
}
|
||||||
PROFILER_LOG_INFO(LOG_CORE, "StackDataRepeater Close, reducedStackCount_ : %" PRIx64 " ", reducedStackCount_);
|
PROFILER_LOG_INFO(LOG_CORE, "StackDataRepeater Close, reducedStackCount_ : %" PRIx64 " ", reducedStackCount_);
|
||||||
|
Loading…
Reference in New Issue
Block a user