Index: base/trace_event/malloc_dump_provider.cc |
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc |
index 3a4017251abf94a6d5421e1c0a90dc715c14bf14..047f2c336d5c6295086316b12f883811ab9f2b0c 100644 |
--- a/base/trace_event/malloc_dump_provider.cc |
+++ b/base/trace_event/malloc_dump_provider.cc |
@@ -294,9 +294,11 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, |
tid_dumping_heap_ = PlatformThread::CurrentId(); |
// At this point the Insert/RemoveAllocation hooks will ignore this thread. |
- // Enclosing all the temporariy data structures in a scope, so that the heap |
- // profiler does not see unabalanced malloc/free calls from these containers. |
+ // Enclosing all the temporary data structures in a scope, so that the heap |
+ // profiler does not see unbalanced malloc/free calls from these containers. |
{ |
+ size_t shim_allocated_objects_size = 0; |
+ size_t shim_allocated_objects_count = 0; |
TraceEventMemoryOverhead overhead; |
std::unordered_map<AllocationContext, AllocationMetrics> metrics_by_context; |
{ |
@@ -307,10 +309,21 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, |
AllocationMetrics& metrics = metrics_by_context[alloc_size.context]; |
metrics.size += alloc_size.size; |
metrics.count++; |
+ |
+ // Aggregate data for objects allocated through the shim. |
+ shim_allocated_objects_size += alloc_size.size; |
+ shim_allocated_objects_count++; |
} |
} |
allocation_register_->EstimateTraceMemoryOverhead(&overhead); |
} |
+ |
+ inner_dump->AddScalar("shim_allocated_objects_size", |
+ MemoryAllocatorDump::kUnitsBytes, |
+ shim_allocated_objects_size); |
+ inner_dump->AddScalar("shim_allocator_object_count", |
+ MemoryAllocatorDump::kUnitsObjects, |
+ shim_allocated_objects_count); |
} // lock(allocation_register_lock_) |
pmd->DumpHeapUsage(metrics_by_context, overhead, "malloc"); |
} |