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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2323483005: [tracing] Add filtering mode in TraceLog (Closed)
Patch Set: Primiano's comments. Created 4 years, 2 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
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 9719a6c672086ad9fc9f1c0d815c0b127efcb430..c095a81967edddfc7d3da82674cad74d02c00e98 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -201,12 +201,31 @@ void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
nullptr);
#endif
+ TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory);
+
+ // TODO(ssid): This should be done in EnableHeapProfiling so that we capture
+ // more allocations (crbug.com/625170).
+ if (AllocationContextTracker::capture_mode() ==
+ AllocationContextTracker::CaptureMode::PSEUDO_STACK &&
+ !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) {
+ TraceConfig::EventFilterConfig heap_profiler_filter_config(
+ TraceLog::TraceEventFilter::kHeapProfilerPredicate);
+ heap_profiler_filter_config.AddIncludedCategory("*");
+ heap_profiler_filter_config.AddIncludedCategory(
+ MemoryDumpManager::kTraceCategory);
+ TraceConfig::EventFilters filters;
+ filters.push_back(heap_profiler_filter_config);
+ TraceConfig filtering_trace_config;
+ filtering_trace_config.SetEventFilterConfigs(filters);
+ TraceLog::GetInstance()->SetEnabled(filtering_trace_config,
oystein (OOO til 10th of July) 2016/10/13 00:34:29 bikeshedding readability nit: Maybe a break here a
ssid 2016/10/13 17:30:54 Done.
+ TraceLog::FILTERING_MODE);
+ }
+
// If tracing was enabled before initializing MemoryDumpManager, we missed the
// OnTraceLogEnabled() event. Synthetize it so we can late-join the party.
- bool is_tracing_already_enabled = TraceLog::GetInstance()->IsEnabled();
- TRACE_EVENT0(kTraceCategory, "init"); // Add to trace-viewer category list.
+ bool tracing_already_enabled = TraceLog::GetInstance()->IsEnabled();
oystein (OOO til 10th of July) 2016/10/13 00:34:29 nit and not about this CL (but since you're touchi
ssid 2016/10/13 17:30:54 Um, this is done here so that we do not call OnTra
Primiano Tucci (use gerrit) 2016/10/13 19:11:24 Correct ;-)
oystein (OOO til 10th of July) 2016/10/13 19:20:18 Yep makes sense; comment still needed I think :)
TraceLog::GetInstance()->AddEnabledStateObserver(this);
- if (is_tracing_already_enabled)
+ if (tracing_already_enabled)
OnTraceLogEnabled();
}

Powered by Google App Engine
This is Rietveld 408576698