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

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

Issue 1200833008: Adding freelist statistics to blink gc dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@oilpan_n2
Patch Set: Nits. 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.h » ('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 d6c57cb4422785de3554b671e96c0070ef35d551..7b2f58714dd2c1adf96a7c006cae4eb55353dfb8 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -43,6 +43,7 @@
#include "platform/heap/ThreadState.h"
#include "public/platform/Platform.h"
#include "public/platform/WebMemoryAllocatorDump.h"
+#include "public/platform/WebProcessMemoryDump.h"
#include "wtf/Assertions.h"
#include "wtf/ContainerAnnotations.h"
#include "wtf/LeakAnnotations.h"
@@ -562,6 +563,15 @@ bool NormalPageHeap::pagesToBeSweptContains(Address address)
}
#endif
+void NormalPageHeap::takeFreelistSnapshot(const String& dumpName)
+{
+ if (m_freeList.takeSnapshot(dumpName) && m_firstUnsweptPage) {
haraken 2015/06/25 00:50:21 What is the '&& m_firstUnsweptPage' check for?
ssid 2015/06/25 03:08:07 the m_firstUnsweptPage checks for if there is any
+ WebMemoryAllocatorDump* bucketsDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName + "/buckets");
+ WebMemoryAllocatorDump* pagesDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName + "/pages");
+ BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwnershipEdge(pagesDump->guid(), bucketsDump->guid());
+ }
+}
+
#if ENABLE(GC_PROFILING)
void NormalPageHeap::snapshotFreeList(TracedValue& json)
{
@@ -1120,6 +1130,26 @@ int FreeList::bucketIndexForSize(size_t size)
return index;
}
+bool FreeList::takeSnapshot(const String& dumpBaseName)
+{
+ bool didDumpBucketStats = false;
+ for (size_t i = 0; i < blinkPageSizeLog2; ++i) {
+ size_t entryCount = 0;
+ size_t freeSize = 0;
+ for (FreeListEntry* entry = m_freeLists[i]; entry; entry = entry->next()) {
+ ++entryCount;
+ freeSize += entry->size();
+ }
+
+ String dumpName = dumpBaseName + String::format("/buckets/bucket_%lu", static_cast<unsigned long>(1 << i));
+ WebMemoryAllocatorDump* bucketDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
+ bucketDump->AddScalar("freelist_entry_count", "objects", entryCount);
+ bucketDump->AddScalar("free_size", "bytes", freeSize);
+ didDumpBucketStats = true;
+ }
+ return didDumpBucketStats;
+}
+
#if ENABLE(GC_PROFILING)
void FreeList::getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalFreeSize) const
{
@@ -1453,7 +1483,7 @@ void NormalPage::markOrphaned()
void NormalPage::takeSnapshot(String dumpName, size_t pageIndex)
{
- dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
+ dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long>(pageIndex)));
WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
HeapObjectHeader* header = nullptr;
@@ -1662,7 +1692,7 @@ void LargeObjectPage::markOrphaned()
void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex)
{
- dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
+ dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long>(pageIndex)));
WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
size_t liveSize = 0;
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698