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

Unified Diff: base/trace_event/sharded_allocation_register.cc

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Rebase Created 3 years, 6 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 | « base/trace_event/sharded_allocation_register.h ('k') | base/trace_event/trace_event_memory_overhead.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/sharded_allocation_register.cc
diff --git a/base/trace_event/sharded_allocation_register.cc b/base/trace_event/sharded_allocation_register.cc
index f1e2d3cac4457d583d83622997fa122ecdd61e1b..112f48f010595a7f2b47e48cca0e968f284ada71 100644
--- a/base/trace_event/sharded_allocation_register.cc
+++ b/base/trace_event/sharded_allocation_register.cc
@@ -69,24 +69,15 @@ void ShardedAllocationRegister::EstimateTraceMemoryOverhead(
allocated, resident);
}
-ShardedAllocationRegister::OutputMetrics
-ShardedAllocationRegister::UpdateAndReturnsMetrics(MetricsMap& map) const {
- OutputMetrics output_metrics;
- output_metrics.size = 0;
- output_metrics.count = 0;
+void ShardedAllocationRegister::VisitAllocations(
+ const AllocationVisitor& visitor) const {
for (size_t i = 0; i < ShardCount; ++i) {
RegisterAndLock& ral = allocation_registers_[i];
AutoLock lock(ral.lock);
- for (const auto& alloc_size : ral.allocation_register) {
- AllocationMetrics& metrics = map[alloc_size.context];
- metrics.size += alloc_size.size;
- metrics.count++;
-
- output_metrics.size += alloc_size.size;
- output_metrics.count++;
+ for (const auto& alloc : ral.allocation_register) {
+ visitor.Run(alloc);
}
}
- return output_metrics;
}
ShardedAllocationRegister::RegisterAndLock::RegisterAndLock() = default;
« no previous file with comments | « base/trace_event/sharded_allocation_register.h ('k') | base/trace_event/trace_event_memory_overhead.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698