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

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

Issue 2847823004: [tracing] Allow enabling heap profiling from chrome://flags (Closed)
Patch Set: Rebase Created 3 years, 7 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/base_switches.cc ('k') | chrome/browser/about_flags.cc » ('j') | 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 <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
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
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
OLDNEW
« no previous file with comments | « base/base_switches.cc ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698