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

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
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index d6c57cb4422785de3554b671e96c0070ef35d551..23509771c2442e42141e91334c5b28da6f9303d0 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -519,11 +519,9 @@ NormalPageHeap::NormalPageHeap(ThreadState* state, int index)
, m_remainingAllocationSize(0)
, m_lastRemainingAllocationSize(0)
, m_promptlyFreedSize(0)
-#if ENABLE(GC_PROFILING)
, m_cumulativeAllocationSize(0)
, m_allocationCount(0)
, m_inlineAllocationCount(0)
-#endif
{
clearFreeLists();
}
@@ -562,6 +560,18 @@ bool NormalPageHeap::pagesToBeSweptContains(Address address)
}
#endif
+void NormalPageHeap::takeFreelistSnapshot(String dumpName)
+{
+ dumpName.append("/buckets");
+ WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
+ allocatorDump->AddScalar("cumulative_allocation_size", "bytes", m_cumulativeAllocationSize);
+ allocatorDump->AddScalarF("inline_allocation_rate", static_cast<double>(m_inlineAllocationCount) / m_allocationCount);
+ allocatorDump->AddScalar("inline_allocation_count", "objects", m_inlineAllocationCount);
+ allocatorDump->AddScalar("allocation_count", "objects", m_allocationCount);
+
+ m_freeList.takeSnapshot(dumpName);
+}
+
#if ENABLE(GC_PROFILING)
void NormalPageHeap::snapshotFreeList(TracedValue& json)
{
@@ -1120,6 +1130,24 @@ int FreeList::bucketIndexForSize(size_t size)
return index;
}
+void FreeList::takeSnapshot(const String& dumpBaseName)
+{
+ 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.isolatedCopy();
haraken 2015/06/23 05:38:58 Shall we pass in a String to takeSnapshot and avoi
ssid 2015/06/23 06:03:39 hm, This is inside the for loop. I can't find a be
haraken 2015/06/23 06:24:24 For string append, we're encouraged to use StringB
ssid 2015/06/23 07:39:56 Sorry, i just realized it has a + operator, though
+ dumpName.append(String::format("/bucket_%lu", static_cast<unsigned long>(i)));
haraken 2015/06/23 05:38:58 It would be more informative to use 2^i instead of
ssid 2015/06/23 07:39:56 Done.
+ WebMemoryAllocatorDump* bucketDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
+ bucketDump->AddScalar("freelist_entry_count", "objects", entryCount);
+ bucketDump->AddScalar("free_size", "bytes", freeSize);
+ }
+}
+
#if ENABLE(GC_PROFILING)
void FreeList::getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalFreeSize) const
{
@@ -1453,7 +1481,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 +1690,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;

Powered by Google App Engine
This is Rietveld 408576698