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

Unified Diff: base/trace_event/heap_profiler_event_writer.cc

Issue 2980083002: [tracing] Add trace events to key heap profiler functions. (Closed)
Patch Set: Don't trace in TraceLog Created 3 years, 5 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 | base/trace_event/heap_profiler_stack_frame_deduplicator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | base/trace_event/heap_profiler_stack_frame_deduplicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698