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

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: Increase Backtrace frames, request even more frames 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
« no previous file with comments | « base/trace_event/heap_profiler_stack_frame_deduplicator.cc ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5ae7460e2f78fbeb530f8b5e659e0e9cd2baf7da..4ff8d5da9a15227e2dcecac14836530c249090ed 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -170,7 +170,26 @@ 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.";
+ }
+
for (auto mdp : dump_providers_)
mdp->dump_provider->OnHeapProfilingEnabled(true);
heap_profiling_enabled_ = true;
« no previous file with comments | « base/trace_event/heap_profiler_stack_frame_deduplicator.cc ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698