| Index: base/trace_event/heap_profiler_event_writer.cc
|
| diff --git a/base/trace_event/heap_profiler_event_writer.cc b/base/trace_event/heap_profiler_event_writer.cc
|
| index 23fe761f58ac32a32e3c68dceabdc713ae5fa617..c09a1e2a4bd516022f9cb10f4a07e630993bb893 100644
|
| --- a/base/trace_event/heap_profiler_event_writer.cc
|
| +++ b/base/trace_event/heap_profiler_event_writer.cc
|
| @@ -17,6 +17,7 @@
|
| #include "base/trace_event/heap_profiler_string_deduplicator.h"
|
| #include "base/trace_event/heap_profiler_type_name_deduplicator.h"
|
| #include "base/trace_event/sharded_allocation_register.h"
|
| +#include "base/trace_event/trace_event.h"
|
| #include "base/trace_event/trace_event_argument.h"
|
|
|
| namespace base {
|
| @@ -44,6 +45,7 @@ struct AggregationKey {
|
| std::unique_ptr<TracedValue> SerializeHeapDump(
|
| const ShardedAllocationRegister& allocation_register,
|
| HeapProfilerSerializationState* serialization_state) {
|
| + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory-infra"), "SerializeHeapDump");
|
| // Aggregate allocations by {backtrace_id, type_id} key.
|
| using MetricsMap = std::unordered_map<AggregationKey, AllocationMetrics,
|
| AggregationKey::Hasher>;
|
| @@ -67,9 +69,13 @@ std::unique_ptr<TracedValue> SerializeHeapDump(
|
| metrics.size += allocation.size;
|
| metrics.count += 1;
|
| };
|
| - allocation_register.VisitAllocations(base::BindRepeating(
|
| - visit_allocation, base::Unretained(serialization_state),
|
| - base::Unretained(&metrics_by_key)));
|
| + {
|
| + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory-infra"),
|
| + "SerializeHeapDump.VisitAllocations");
|
| + allocation_register.VisitAllocations(base::BindRepeating(
|
| + visit_allocation, base::Unretained(serialization_state),
|
| + base::Unretained(&metrics_by_key)));
|
| + }
|
|
|
| auto traced_value = MakeUnique<TracedValue>();
|
|
|
| @@ -101,6 +107,8 @@ std::unique_ptr<TracedValue> SerializeHeapDump(
|
| std::unique_ptr<TracedValue> SerializeHeapProfileEventData(
|
| const SerializedHeapDumpsMap& heap_dumps,
|
| HeapProfilerSerializationState* serialization_state) {
|
| + TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory-infra"),
|
| + "SerializeHeapProfileEventData");
|
| auto traced_value = MakeUnique<TracedValue>();
|
|
|
| // See brief description of the format in the header file.
|
|
|