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

Unified Diff: base/trace_event/malloc_dump_provider.cc

Issue 2865333002: Adding malloc allocator metric for objects allocated through shim (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698