!7920 修复部分dump场景卡顿

Merge pull request !7920 from zhanheng/fix_dump
This commit is contained in:
openharmony_ci 2024-06-25 07:26:42 +00:00 committed by Gitee
commit 0ad9ef9f48
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 16 additions and 11 deletions

View File

@ -163,7 +163,7 @@ void HeapProfiler::DumpHeapSnapshot([[maybe_unused]] DumpFormat dumpFormat, [[ma
}
FileDescriptorStream stream(fd);
DumpHeapSnapshot(
dumpFormat, &stream, nullptr, isVmMode, isPrivate, captureNumericValue, isFullGC, isSimplify, isSync);
dumpFormat, &stream, nullptr, isVmMode, isPrivate, captureNumericValue, isFullGC, isSimplify, isSync, false);
#endif
}
@ -272,7 +272,7 @@ void HeapProfiler::FillIdMap()
bool HeapProfiler::DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progress *progress,
bool isVmMode, bool isPrivate, bool captureNumericValue,
bool isFullGC, bool isSimplify, bool isSync)
bool isFullGC, bool isSimplify, bool isSync, bool isBeforeFill)
{
bool res = false;
base::BlockHookScope blockScope;
@ -290,11 +290,13 @@ bool HeapProfiler::DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progr
DISALLOW_GARBAGE_COLLECTION;
const_cast<Heap *>(vm_->GetHeap())->Prepare();
}
Runtime::GetInstance()->GCIterateThreadList([&](JSThread *thread) {
ASSERT(!thread->IsInRunningState());
const_cast<Heap*>(thread->GetEcmaVM()->GetHeap())->FillBumpPointerForTlab();
});
FillIdMap();
if (isBeforeFill) {
Runtime::GetInstance()->GCIterateThreadList([&](JSThread *thread) {
ASSERT(!thread->IsInRunningState());
const_cast<Heap*>(thread->GetEcmaVM()->GetHeap())->FillBumpPointerForTlab();
});
FillIdMap();
}
// fork
if ((pid = ForkBySyscall()) < 0) {
LOG_ECMA(ERROR) << "DumpHeapSnapshot fork failed!";

View File

@ -90,7 +90,8 @@ public:
*/
bool DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progress *progress = nullptr,
bool isVmMode = true, bool isPrivate = false, bool captureNumericValue = false,
bool isFullGC = true, bool isSimplify = false, bool isSync = true) override;
bool isFullGC = true, bool isSimplify = false, bool isSync = true,
bool isBeforeFill = true) override;
void DumpHeapSnapshot(DumpFormat dumpFormat, bool isVmMode = true, bool isPrivate = false,
bool captureNumericValue = false, bool isFullGC = true,
bool isSimplify = false, bool isSync = true) override;

View File

@ -42,7 +42,8 @@ public:
virtual void MoveEvent(uintptr_t address, TaggedObject *forwardAddress, size_t size)= 0;
virtual bool DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progress *progress = nullptr,
bool isVmMode = true, bool isPrivate = false, bool captureNumericValue = false,
bool isFullGC = true, bool isSimplify = false, bool isSync = true) = 0;
bool isFullGC = true, bool isSimplify = false, bool isSync = true,
bool isBeforeFill = true) = 0;
// Provide an internal interface for oom dump.
virtual void DumpHeapSnapshot(DumpFormat dumpFormat, bool isVmMode = true, bool isPrivate = false,
bool captureNumericValue = false, bool isFullGC = true,

View File

@ -90,10 +90,11 @@ public:
bool DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progress *progress = nullptr,
bool isVmMode = true, bool isPrivate = false, bool captureNumericValue = false,
bool isFullGC = true, bool isSimplify = false, bool isSync = false) override
bool isFullGC = true, bool isSimplify = false, bool isSync = false,
bool isBeforeFill = true) override
{
return profiler_->DumpHeapSnapshot(dumpFormat, stream, progress, isVmMode, isPrivate, captureNumericValue,
isFullGC, isSimplify, isSync);
isFullGC, isSimplify, isSync, isBeforeFill);
}
void DumpHeapSnapshot(DumpFormat dumpFormat, bool isVmMode = true, bool isPrivate = false,