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

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

Issue 1149703002: Adding heap-page statistics to blink-gc memory dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@oilpan_v1
Patch Set: Rebase and change %zu to %lu. 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') | no next file » | 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 725a025011133b6bcee970fbcf12516d28b73430..d6c57cb4422785de3554b671e96c0070ef35d551 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -261,12 +261,13 @@ void BaseHeap::cleanupPages()
void BaseHeap::takeSnapshot(const String& dumpBaseName)
{
- size_t pageCount = 0;
+ WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
+ size_t pageIndex = 0;
for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) {
- pageCount++;
+ page->takeSnapshot(dumpBaseName, pageIndex);
+ pageIndex++;
}
- WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
- allocatorDump->AddScalar("blink_page_count", "objects", pageCount);
+ allocatorDump->AddScalar("blink_page_count", "objects", pageIndex);
}
#if ENABLE(ASSERT) || ENABLE(GC_PROFILING)
@@ -1450,6 +1451,40 @@ void NormalPage::markOrphaned()
BasePage::markOrphaned();
}
+void NormalPage::takeSnapshot(String dumpName, size_t pageIndex)
+{
+ dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
+ WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
+
+ HeapObjectHeader* header = nullptr;
+ size_t liveCount = 0;
+ size_t deadCount = 0;
+ size_t freeCount = 0;
+ size_t liveSize = 0;
+ size_t deadSize = 0;
+ size_t freeSize = 0;
+ for (Address headerAddress = payload(); headerAddress < payloadEnd(); headerAddress += header->size()) {
+ header = reinterpret_cast<HeapObjectHeader*>(headerAddress);
+ if (header->isFree()) {
+ freeCount++;
+ freeSize += header->size();
+ } else if (header->isMarked()) {
+ liveCount++;
+ liveSize += header->size();
+ } else {
+ deadCount++;
+ deadSize += header->size();
+ }
+ }
+
+ pageDump->AddScalar("live_count", "objects", liveCount);
+ pageDump->AddScalar("dead_count", "objects", deadCount);
+ pageDump->AddScalar("free_count", "objects", freeCount);
+ pageDump->AddScalar("live_size", "bytes", liveSize);
+ pageDump->AddScalar("dead_size", "bytes", deadSize);
+ pageDump->AddScalar("free_size", "bytes", freeSize);
+}
+
#if ENABLE(GC_PROFILING)
const GCInfo* NormalPage::findGCInfo(Address address)
{
@@ -1625,6 +1660,30 @@ void LargeObjectPage::markOrphaned()
BasePage::markOrphaned();
}
+void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex)
+{
+ dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
+ WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
+
+ size_t liveSize = 0;
+ size_t deadSize = 0;
+ size_t liveCount = 0;
+ size_t deadCount = 0;
+ HeapObjectHeader* header = heapObjectHeader();
+ if (header->isMarked()) {
+ liveCount = 1;
+ liveSize += header->size();
+ } else {
+ deadCount = 1;
+ deadSize += header->size();
+ }
+
+ pageDump->AddScalar("live_count", "objects", liveCount);
+ pageDump->AddScalar("dead_count", "objects", deadCount);
+ pageDump->AddScalar("live_size", "bytes", liveSize);
+ pageDump->AddScalar("dead_size", "bytes", deadSize);
+}
+
#if ENABLE(GC_PROFILING)
const GCInfo* LargeObjectPage::findGCInfo(Address address)
{
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698