Chromium Code Reviews| 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 e627183e10da1647abc245c42f10eb227950ecaa..1232a60afa9c1b504784603675f0759f8bc4b84a 100644 |
| --- a/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| +++ b/third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp |
| @@ -64,16 +64,18 @@ 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::AllocationsSizeAndCount> 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) { |
| + metricsByContext[allocSize.context].size += allocSize.size; |
| + metricsByContext[allocSize.context].count++; |
|
Dmitry Skiba
2016/04/14 19:07:30
Avoid second lookup.
ssid
2016/04/14 20:17:11
Done.
|
| + } |
| } |
| m_allocationRegister->EstimateTraceMemoryOverhead(&overhead); |
| } |
| - memoryDump->dumpHeapUsage(bytesByContext, overhead, "blink_gc"); |
| + memoryDump->dumpHeapUsage(metricsByContext, overhead, "blink_gc"); |
| } |
| // Merge all dumps collected by Heap::collectGarbage. |