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

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: Address comments 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..5939ed26daae56a054c2eaa19a2dd0f9a4e439cb 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);
+ if (profiling_mode == "") {
+ AllocationContextTracker::SetCaptureMode(
+ AllocationContextTracker::CaptureMode::PSEUDO_STACK);
+ }
+ else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
+#if ENABLE_NATIVE_ALLOCATION_TRACES
+ AllocationContextTracker::SetCaptureMode(
+ AllocationContextTracker::CaptureMode::NATIVE_STACK);
+#else
+ CHECK(false) << "'" << profiling_mode << "' mode for "
+ << switches::kEnableHeapProfiling << " flag is not supported "
+ << "for this platform / build type.";
+#endif
+ } else {
+ CHECK(false) << "Invalid mode '" << profiling_mode << "' for "
+ << switches::kEnableHeapProfiling << " flag.";
+
+ // If the above didn't crash, use some default
Primiano Tucci (use gerrit) 2016/04/21 20:08:21 uh wat? If the above didn't crash we have some ser
Dmitry Skiba 2016/04/22 06:31:15 Done.
+ 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