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

Unified Diff: Source/platform/PartitionAllocMemoryDumpProvider.cpp

Issue 1312843010: [tracing] Fix PartitionAlloc dumper reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: const size_t ... meh Created 5 years, 3 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 | « no previous file | Source/wtf/Partitions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/PartitionAllocMemoryDumpProvider.cpp
diff --git a/Source/platform/PartitionAllocMemoryDumpProvider.cpp b/Source/platform/PartitionAllocMemoryDumpProvider.cpp
index 3102f5913e52a96595a12099b0260c0b962c77a8..09b6be9110d8443a65b72116bc7253bafc9cabba 100644
--- a/Source/platform/PartitionAllocMemoryDumpProvider.cpp
+++ b/Source/platform/PartitionAllocMemoryDumpProvider.cpp
@@ -8,7 +8,6 @@
#include "public/platform/WebMemoryAllocatorDump.h"
#include "public/platform/WebProcessMemoryDump.h"
#include "wtf/Partitions.h"
-#include "wtf/Threading.h"
namespace blink {
@@ -16,9 +15,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 +30,34 @@ 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;
+ 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);
+ 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);
}
void PartitionStatsDumperImpl::partitionsDumpBucketStats(const char* partitionName, const PartitionBucketMemoryStats* memoryStats)
@@ -67,26 +65,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("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 +90,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));
+ allocatedObjectsDump->AddScalar("size", "bytes", partitionStatsDumper.totalActiveBytes());
+ memoryDump->AddOwnershipEdge(allocatedObjectsDump->guid(), partitionsDump->guid());
+
return true;
}
« no previous file with comments | « no previous file | Source/wtf/Partitions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698