Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: Source/platform/heap/Heap.cpp

Issue 1149673002: Adding blink gc memory dump infrastructure for thread specific dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and replacing main thread with thread id. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index 71ffd4fe938cf55e8bbaf6f19b47d8f5c285fae0..725a025011133b6bcee970fbcf12516d28b73430 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -34,6 +34,7 @@
#include "platform/ScriptForbiddenScope.h"
#include "platform/Task.h"
#include "platform/TraceEvent.h"
+#include "platform/heap/BlinkGCMemoryDumpProvider.h"
#include "platform/heap/CallbackStack.h"
#include "platform/heap/MarkingVisitor.h"
#include "platform/heap/PageMemory.h"
@@ -41,6 +42,7 @@
#include "platform/heap/SafePoint.h"
#include "platform/heap/ThreadState.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebMemoryAllocatorDump.h"
#include "wtf/Assertions.h"
#include "wtf/ContainerAnnotations.h"
#include "wtf/LeakAnnotations.h"
@@ -257,6 +259,16 @@ void BaseHeap::cleanupPages()
m_firstPage = nullptr;
}
+void BaseHeap::takeSnapshot(const String& dumpBaseName)
+{
+ size_t pageCount = 0;
+ for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) {
+ pageCount++;
+ }
+ WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
+ allocatorDump->AddScalar("blink_page_count", "objects", pageCount);
+}
+
#if ENABLE(ASSERT) || ENABLE(GC_PROFILING)
BasePage* BaseHeap::findPageFromAddress(Address address)
{
@@ -1746,10 +1758,15 @@ void Heap::init()
s_estimatedMarkingTimePerByte = 0.0;
GCInfoTable::init();
+
+ if (Platform::current() && Platform::current()->currentThread())
+ Platform::current()->registerMemoryDumpProvider(BlinkGCMemoryDumpProvider::instance());
}
void Heap::shutdown()
{
+ if (Platform::current() && Platform::current()->currentThread())
+ Platform::current()->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvider::instance());
s_shutdownCalled = true;
ThreadState::shutdownHeapIfNecessary();
}
@@ -2003,6 +2020,9 @@ void Heap::collectGarbage(ThreadState::StackState stackState, ThreadState::GCTyp
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink_gc", "BlinkGC");
double timeStamp = WTF::currentTimeMS();
+ if (gcType == ThreadState::TakeSnapshot)
+ BlinkGCMemoryDumpProvider::instance()->clearProcessDumpForCurrentGC();
+
// Disallow allocation during garbage collection (but not during the
// finalization that happens when the gcScope is torn down).
ThreadState::NoAllocationScope noAllocationScope(state);
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698