OLD | NEW |
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 <inttypes.h> | 7 #include <inttypes.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 if (!CommandLine::InitializedForCurrentProcess() || | 188 if (!CommandLine::InitializedForCurrentProcess() || |
189 !CommandLine::ForCurrentProcess()->HasSwitch( | 189 !CommandLine::ForCurrentProcess()->HasSwitch( |
190 switches::kEnableHeapProfiling)) | 190 switches::kEnableHeapProfiling)) |
191 return; | 191 return; |
192 | 192 |
193 std::string profiling_mode = CommandLine::ForCurrentProcess() | 193 std::string profiling_mode = CommandLine::ForCurrentProcess() |
194 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); | 194 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); |
195 if (profiling_mode == "") { | 195 if (profiling_mode == "") { |
196 AllocationContextTracker::SetCaptureMode( | 196 AllocationContextTracker::SetCaptureMode( |
197 AllocationContextTracker::CaptureMode::PSEUDO_STACK); | 197 AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
198 #if HAVE_TRACE_STACK_FRAME_POINTERS && \ | 198 #if (BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS) || !defined(NDEBUG)) |
199 (BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)) | |
200 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { | 199 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { |
201 // We need frame pointers for native tracing to work, and they are | 200 // We need frame pointers for native tracing to work, and they are |
202 // enabled in profiling and debug builds. | 201 // enabled in profiling and debug builds. |
203 AllocationContextTracker::SetCaptureMode( | 202 AllocationContextTracker::SetCaptureMode( |
204 AllocationContextTracker::CaptureMode::NATIVE_STACK); | 203 AllocationContextTracker::CaptureMode::NATIVE_STACK); |
205 #endif | 204 #endif |
206 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) | 205 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) |
207 } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) { | 206 } else if (profiling_mode == switches::kEnableHeapProfilingTaskProfiler) { |
208 // Enable heap tracking, which in turn enables capture of heap usage | 207 // Enable heap tracking, which in turn enables capture of heap usage |
209 // tracking in tracked_objects.cc. | 208 // tracking in tracked_objects.cc. |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 if (iter == process_dumps.end()) { | 981 if (iter == process_dumps.end()) { |
983 std::unique_ptr<ProcessMemoryDump> new_pmd( | 982 std::unique_ptr<ProcessMemoryDump> new_pmd( |
984 new ProcessMemoryDump(session_state, dump_args)); | 983 new ProcessMemoryDump(session_state, dump_args)); |
985 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 984 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
986 } | 985 } |
987 return iter->second.get(); | 986 return iter->second.get(); |
988 } | 987 } |
989 | 988 |
990 } // namespace trace_event | 989 } // namespace trace_event |
991 } // namespace base | 990 } // namespace base |
OLD | NEW |