Chromium Code Reviews| Index: Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| diff --git a/Source/platform/PartitionAllocMemoryDumpProvider.cpp b/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| index 3102f5913e52a96595a12099b0260c0b962c77a8..f8a2caf9ed5b87037cce4545968d04766f876e51 100644 |
| --- a/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| +++ b/Source/platform/PartitionAllocMemoryDumpProvider.cpp |
| @@ -16,9 +16,12 @@ namespace { |
| using namespace WTF; |
| +const char kPartitionAllocDumpName[] = "partition_alloc"; |
| +const char kPartitionsDumpName[] = "partitions"; |
| + |
| String getPartitionDumpName(const char* partitionName) |
| { |
| - return String::format("partition_alloc/thread_%lu/%s", static_cast<unsigned long>(WTF::currentThread()), partitionName); |
| + return String::format("%s/%s/%s", kPartitionAllocDumpName, kPartitionsDumpName, partitionName); |
| } |
| // This class is used to invert the dependency of PartitionAlloc on the |
| @@ -28,38 +31,32 @@ class PartitionStatsDumperImpl final : public PartitionStatsDumper { |
| public: |
| PartitionStatsDumperImpl(WebProcessMemoryDump* memoryDump, WebMemoryDumpLevelOfDetail levelOfDetail) |
| : m_memoryDump(memoryDump) |
| - , m_levelOfDetail(levelOfDetail) |
| - , m_uid(0) { } |
| + , m_uid(0) |
| + , m_totalActiveBytes(0) { } |
| // PartitionStatsDumper implementation. |
| void partitionDumpTotals(const char* partitionName, const PartitionMemoryStats*) override; |
| void partitionsDumpBucketStats(const char* partitionName, const PartitionBucketMemoryStats*) override; |
| + const size_t totalActiveBytes() const { return m_totalActiveBytes; } |
| + |
| private: |
| WebProcessMemoryDump* m_memoryDump; |
| - WebMemoryDumpLevelOfDetail m_levelOfDetail; |
| - size_t m_uid; |
| + unsigned long m_uid; |
| + size_t m_totalActiveBytes; |
| }; |
| void PartitionStatsDumperImpl::partitionDumpTotals(const char* partitionName, const PartitionMemoryStats* memoryStats) |
| { |
| + m_totalActiveBytes += memoryStats->totalActiveBytes; |
| String dumpName = getPartitionDumpName(partitionName); |
| WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorDump(dumpName); |
| - allocatorDump->AddScalar("size", "bytes", memoryStats->totalMmappedBytes); |
| - allocatorDump->AddScalar("committed_size", "bytes", memoryStats->totalCommittedBytes); |
| - allocatorDump->AddScalar("active_size", "bytes", memoryStats->totalActiveBytes); |
| - allocatorDump->AddScalar("resident_size", "bytes", memoryStats->totalResidentBytes); |
| + allocatorDump->AddScalar("size", "bytes", memoryStats->totalResidentBytes); |
|
haraken
2015/09/07 23:24:26
Sorry for repeating the discussion again: Do we re
Primiano Tucci (use gerrit)
2015/09/08 07:56:56
No worries, better to spend time to make sure we m
haraken
2015/09/08 08:07:33
When PA commits 1 MB of system pages but doesn't y
Primiano Tucci (use gerrit)
2015/09/08 10:22:28
Let me check if I am getting this right. You are t
|
| + allocatorDump->AddScalar("allocated_objects_size", "bytes", memoryStats->totalActiveBytes); |
| + allocatorDump->AddScalar("virtual_size", "bytes", memoryStats->totalMmappedBytes); |
| + allocatorDump->AddScalar("virtual_committed_size", "bytes", memoryStats->totalCommittedBytes); |
| allocatorDump->AddScalar("decommittable_size", "bytes", memoryStats->totalDecommittableBytes); |
| - allocatorDump->AddScalar("discardable_size", "bytes", memoryStats->totalDiscardableBytes); |
| - |
| - // If detailed dumps, allocated_objects size will be aggregated from the |
| - // children. |
| - if (m_levelOfDetail == WebMemoryDumpLevelOfDetail::High) |
| - return; |
| - |
| - dumpName = dumpName + "/allocated_objects"; |
| - WebMemoryAllocatorDump* objectsDump = m_memoryDump->createMemoryAllocatorDump(dumpName); |
| - objectsDump->AddScalar("size", "bytes", memoryStats->totalActiveBytes); |
| + allocatorDump->AddScalar("freeable_size", "bytes", memoryStats->totalDiscardableBytes); |
|
haraken
2015/09/07 23:24:26
Keep "discardable". We consistently use "discardab
Primiano Tucci (use gerrit)
2015/09/08 07:56:56
Hmm ok reverted. I just fear that it might be conf
|
| } |
| void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionName, const PartitionBucketMemoryStats* memoryStats) |
| @@ -67,26 +64,21 @@ void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionNa |
| ASSERT(memoryStats->isValid); |
| String dumpName = getPartitionDumpName(partitionName); |
| if (memoryStats->isDirectMap) |
| - dumpName.append(String::format("/directMap_%lu", static_cast<unsigned long>(++m_uid))); |
| + dumpName.append(String::format("/directMap_%lu", ++m_uid)); |
| else |
| dumpName.append(String::format("/bucket_%u", static_cast<unsigned>(memoryStats->bucketSlotSize))); |
| WebMemoryAllocatorDump* allocatorDump = m_memoryDump->createMemoryAllocatorDump(dumpName); |
| allocatorDump->AddScalar("size", "bytes", memoryStats->residentBytes); |
| + allocatorDump->AddScalar("allocated_objects_size", "bytes", memoryStats->activeBytes); |
| allocatorDump->AddScalar("slot_size", "bytes", memoryStats->bucketSlotSize); |
| - allocatorDump->AddScalar("active_size", "bytes", memoryStats->activeBytes); |
| - allocatorDump->AddScalar("resident_size", "bytes", memoryStats->residentBytes); |
| allocatorDump->AddScalar("decommittable_size", "bytes", memoryStats->decommittableBytes); |
| - allocatorDump->AddScalar("discardable_size", "bytes", memoryStats->discardableBytes); |
| - allocatorDump->AddScalar("num_active", "objects", memoryStats->numActivePages); |
| - allocatorDump->AddScalar("num_full", "objects", memoryStats->numFullPages); |
| - allocatorDump->AddScalar("num_empty", "objects", memoryStats->numEmptyPages); |
| - allocatorDump->AddScalar("num_decommitted", "objects", memoryStats->numDecommittedPages); |
| - allocatorDump->AddScalar("page_size", "bytes", memoryStats->allocatedPageSize); |
| - |
| - dumpName = dumpName + "/allocated_objects"; |
| - WebMemoryAllocatorDump* objectsDump = m_memoryDump->createMemoryAllocatorDump(dumpName); |
| - objectsDump->AddScalar("size", "bytes", memoryStats->activeBytes); |
| + allocatorDump->AddScalar("freeable_size", "bytes", memoryStats->discardableBytes); |
| + allocatorDump->AddScalar("total_pages_size", "bytes", memoryStats->allocatedPageSize); |
| + allocatorDump->AddScalar("active_pages", "objects", memoryStats->numActivePages); |
| + allocatorDump->AddScalar("full_pages", "objects", memoryStats->numFullPages); |
| + allocatorDump->AddScalar("empty_pages", "objects", memoryStats->numEmptyPages); |
| + allocatorDump->AddScalar("decommitted_pages", "objects", memoryStats->numDecommittedPages); |
| } |
| } // namespace |
| @@ -97,12 +89,21 @@ PartitionAllocMemoryDumpProvider* PartitionAllocMemoryDumpProvider::instance() |
| return &instance; |
| } |
| -bool PartitionAllocMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, blink::WebProcessMemoryDump* memoryDump) |
| +bool PartitionAllocMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProcessMemoryDump* memoryDump) |
| { |
| PartitionStatsDumperImpl partitionStatsDumper(memoryDump, levelOfDetail); |
| + WebMemoryAllocatorDump* partitionsDump = memoryDump->createMemoryAllocatorDump( |
| + String::format("%s/%s", kPartitionAllocDumpName, kPartitionsDumpName)); |
| + |
| // This method calls memoryStats.partitionsDumpBucketStats with memory statistics. |
| WTF::Partitions::dumpMemoryStats(levelOfDetail == WebMemoryDumpLevelOfDetail::Low, &partitionStatsDumper); |
| + |
| + WebMemoryAllocatorDump* allocatedObjectsDump = memoryDump->createMemoryAllocatorDump( |
| + String::format("%s/allocated_objects", kPartitionAllocDumpName)); |
|
ssid
2015/09/07 14:48:21
Just wondering if the format is right here (12 spa
Primiano Tucci (use gerrit)
2015/09/07 15:23:20
Looking at other files (and git cl format) this se
|
| + allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalActiveBytes()); |
| + memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->guid()); |
| + |
| return true; |
| } |