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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 if (heap_profiling_enabled_) | 180 if (heap_profiling_enabled_) |
181 return; | 181 return; |
182 | 182 |
183 if (!CommandLine::InitializedForCurrentProcess() || | 183 if (!CommandLine::InitializedForCurrentProcess() || |
184 !CommandLine::ForCurrentProcess()->HasSwitch( | 184 !CommandLine::ForCurrentProcess()->HasSwitch( |
185 switches::kEnableHeapProfiling)) | 185 switches::kEnableHeapProfiling)) |
186 return; | 186 return; |
187 | 187 |
188 std::string profiling_mode = CommandLine::ForCurrentProcess() | 188 std::string profiling_mode = CommandLine::ForCurrentProcess() |
189 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); | 189 ->GetSwitchValueASCII(switches::kEnableHeapProfiling); |
190 if (profiling_mode == "") { | 190 if (profiling_mode == switches::kEnableHeapProfilingModePseudo) { |
191 AllocationContextTracker::SetCaptureMode( | 191 AllocationContextTracker::SetCaptureMode( |
192 AllocationContextTracker::CaptureMode::PSEUDO_STACK); | 192 AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
193 #if !defined(OS_NACL) | 193 #if !defined(OS_NACL) |
194 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { | 194 } else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { |
195 // If we don't have frame pointers then native tracing falls-back to | 195 // If we don't have frame pointers then native tracing falls-back to |
196 // using base::debug::StackTrace, which may be slow. | 196 // using base::debug::StackTrace, which may be slow. |
197 AllocationContextTracker::SetCaptureMode( | 197 AllocationContextTracker::SetCaptureMode( |
198 AllocationContextTracker::CaptureMode::NATIVE_STACK); | 198 AllocationContextTracker::CaptureMode::NATIVE_STACK); |
199 #endif // !defined(OS_NACL) | 199 #endif // !defined(OS_NACL) |
200 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) | 200 #if BUILDFLAG(ENABLE_MEMORY_TASK_PROFILER) |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 if (iter == process_dumps.end()) { | 905 if (iter == process_dumps.end()) { |
906 std::unique_ptr<ProcessMemoryDump> new_pmd( | 906 std::unique_ptr<ProcessMemoryDump> new_pmd( |
907 new ProcessMemoryDump(session_state, dump_args)); | 907 new ProcessMemoryDump(session_state, dump_args)); |
908 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 908 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
909 } | 909 } |
910 return iter->second.get(); | 910 return iter->second.get(); |
911 } | 911 } |
912 | 912 |
913 } // namespace trace_event | 913 } // namespace trace_event |
914 } // namespace base | 914 } // namespace base |
OLD | NEW |