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

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 2790443002: Revert of Cleaner fall-back stack capture for --enable-heap-profiling=native. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/trace_event/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/allocator/features.h" 10 #include "base/allocator/features.h"
(...skipping 17 matching lines...) Expand all
28 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" 28 #include "base/trace_event/heap_profiler_type_name_deduplicator.h"
29 #include "base/trace_event/malloc_dump_provider.h" 29 #include "base/trace_event/malloc_dump_provider.h"
30 #include "base/trace_event/memory_dump_provider.h" 30 #include "base/trace_event/memory_dump_provider.h"
31 #include "base/trace_event/memory_dump_scheduler.h" 31 #include "base/trace_event/memory_dump_scheduler.h"
32 #include "base/trace_event/memory_dump_session_state.h" 32 #include "base/trace_event/memory_dump_session_state.h"
33 #include "base/trace_event/memory_infra_background_whitelist.h" 33 #include "base/trace_event/memory_infra_background_whitelist.h"
34 #include "base/trace_event/process_memory_dump.h" 34 #include "base/trace_event/process_memory_dump.h"
35 #include "base/trace_event/trace_event.h" 35 #include "base/trace_event/trace_event.h"
36 #include "base/trace_event/trace_event_argument.h" 36 #include "base/trace_event/trace_event_argument.h"
37 #include "build/build_config.h" 37 #include "build/build_config.h"
38 #include "build/buildflag.h"
39 38
40 #if defined(OS_ANDROID) 39 #if defined(OS_ANDROID)
41 #include "base/trace_event/java_heap_dump_provider_android.h" 40 #include "base/trace_event/java_heap_dump_provider_android.h"
42 #endif 41 #endif
43 42
44 namespace base { 43 namespace base {
45 namespace trace_event { 44 namespace trace_event {
46 45
47 namespace { 46 namespace {
48 47
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (!CommandLine::InitializedForCurrentProcess() || 182 if (!CommandLine::InitializedForCurrentProcess() ||
184 !CommandLine::ForCurrentProcess()->HasSwitch( 183 !CommandLine::ForCurrentProcess()->HasSwitch(
185 switches::kEnableHeapProfiling)) 184 switches::kEnableHeapProfiling))
186 return; 185 return;
187 186
188 std::string profiling_mode = CommandLine::ForCurrentProcess() 187 std::string profiling_mode = CommandLine::ForCurrentProcess()
189 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); 188 ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
190 if (profiling_mode == "") { 189 if (profiling_mode == "") {
191 AllocationContextTracker::SetCaptureMode( 190 AllocationContextTracker::SetCaptureMode(
192 AllocationContextTracker::CaptureMode::PSEUDO_STACK); 191 AllocationContextTracker::CaptureMode::PSEUDO_STACK);
192 #if HAVE_TRACE_STACK_FRAME_POINTERS && \
193 (BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG))
193 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { 194 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
194 // If we don't have frame pointers then native tracing falls-back to 195 // We need frame pointers for native tracing to work, and they are
195 // using base::debug::StackTrace, which may be slow. 196 // enabled in profiling and debug builds.
196 AllocationContextTracker::SetCaptureMode( 197 AllocationContextTracker::SetCaptureMode(
197 AllocationContextTracker::CaptureMode::NATIVE_STACK); 198 AllocationContextTracker::CaptureMode::NATIVE_STACK);
199 #endif
198 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) 200 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER)
199 } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) { 201 } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) {
200 // Enable heap tracking, which in turn enables capture of heap usage 202 // Enable heap tracking, which in turn enables capture of heap usage
201 // tracking in tracked_objects.cc. 203 // tracking in tracked_objects.cc.
202 if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled()) 204 if (!base::debug::ThreadHeapUsageTracker::IsHeapTrackingEnabled())
203 base::debug::ThreadHeapUsageTracker::EnableHeapTracking(); 205 base::debug::ThreadHeapUsageTracker::EnableHeapTracking();
204 #endif 206 #endif
205 } else { 207 } else {
206 CHECK(false) << "Invalid mode '" << profiling_mode << "' for " 208 CHECK(false) << "Invalid mode '" << profiling_mode << "' for "
207 << switches::kEnableHeapProfiling << " flag."; 209 << switches::kEnableHeapProfiling << " flag.";
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 if (iter == process_dumps.end()) { 1008 if (iter == process_dumps.end()) {
1007 std::unique_ptr<ProcessMemoryDump> new_pmd( 1009 std::unique_ptr<ProcessMemoryDump> new_pmd(
1008 new ProcessMemoryDump(session_state, dump_args)); 1010 new ProcessMemoryDump(session_state, dump_args));
1009 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 1011 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
1010 } 1012 }
1011 return iter->second.get(); 1013 return iter->second.get();
1012 } 1014 }
1013 1015
1014 } // namespace trace_event 1016 } // namespace trace_event
1015 } // namespace base 1017 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698