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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 1839503002: [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert whitespace change in malloc_dump_provider Created 4 years, 8 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 53532b231242ff567e07486f680c1819cf6bb092..43b4fb8e017dbaa353aae959ddeabe2b7e597416 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -169,7 +169,30 @@ void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
switches::kEnableHeapProfiling))
return;
- AllocationContextTracker::SetCaptureEnabled(true);
+ std::string profiling_mode = CommandLine::ForCurrentProcess()
+ ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
+ bool profiling_mode_parsed = false;
+ if (profiling_mode == "") {
+ AllocationContextTracker::SetCaptureMode(
+ AllocationContextTracker::CaptureMode::PSEUDO_STACK);
+ profiling_mode_parsed = true;
+ }
+#if ENABLE_NATIVE_ALLOCATION_TRACES
+ else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
+ AllocationContextTracker::SetCaptureMode(
+ AllocationContextTracker::CaptureMode::NATIVE_STACK);
+ profiling_mode_parsed = true;
+ }
+#endif
+ if (!profiling_mode_parsed) {
+ LOG(ERROR) << "Ignored unknown mode '" << profiling_mode << "' for "
Primiano Tucci (use gerrit) 2016/04/19 20:15:19 there is a discussion on chromium-dev about LOG. T
Dmitry Skiba 2016/04/20 19:19:25 Done.
+ << switches::kEnableHeapProfiling << " flag.";
+
+ // Enable pseudo stacks
+ AllocationContextTracker::SetCaptureMode(
+ AllocationContextTracker::CaptureMode::PSEUDO_STACK);
+ }
+
for (auto mdp : dump_providers_)
mdp->dump_provider->OnHeapProfilingEnabled(true);
heap_profiling_enabled_ = true;

Powered by Google App Engine
This is Rietveld 408576698