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

Unified Diff: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp

Issue 1877313003: [tracing] Track number of allocations in heap profiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix indentation. Created 4 years, 8 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: third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
diff --git a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
index eea1e747c6a08964d482adae8e10dee18a147253..a0f755685c84f7232c01a581cd68e62ee8fcce2a 100644
--- a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
+++ b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp
@@ -64,16 +64,19 @@ bool BlinkGCMemoryDumpProvider::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfD
if (m_isHeapProfilingEnabled) {
// Overhead should always be reported, regardless of light vs. heavy.
base::trace_event::TraceEventMemoryOverhead overhead;
- base::hash_map<base::trace_event::AllocationContext, size_t> bytesByContext;
+ base::hash_map<base::trace_event::AllocationContext, base::trace_event::AllocationMetrics> metricsByContext;
{
MutexLocker locker(m_allocationRegisterMutex);
if (levelOfDetail == WebMemoryDumpLevelOfDetail::Detailed) {
- for (const auto& allocSize : *m_allocationRegister)
- bytesByContext[allocSize.context] += allocSize.size;
+ for (const auto& allocSize : *m_allocationRegister) {
+ base::trace_event::AllocationMetrics& metrics = metricsByContext[allocSize.context];
+ metrics.size += allocSize.size;
+ metrics.count++;
+ }
}
m_allocationRegister->EstimateTraceMemoryOverhead(&overhead);
}
- memoryDump->dumpHeapUsage(bytesByContext, overhead, "blink_gc");
+ memoryDump->dumpHeapUsage(metricsByContext, overhead, "blink_gc");
}
// Merge all dumps collected by ThreadHeap::collectGarbage.

Powered by Google App Engine
This is Rietveld 408576698