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

Side by Side 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: Add type to StackFrame; format thread name 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 unified diff | Download patch
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/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void MemoryDumpManager::EnableHeapProfilingIfNeeded() { 163 void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
164 if (heap_profiling_enabled_) 164 if (heap_profiling_enabled_)
165 return; 165 return;
166 166
167 if (!CommandLine::InitializedForCurrentProcess() || 167 if (!CommandLine::InitializedForCurrentProcess() ||
168 !CommandLine::ForCurrentProcess()->HasSwitch( 168 !CommandLine::ForCurrentProcess()->HasSwitch(
169 switches::kEnableHeapProfiling)) 169 switches::kEnableHeapProfiling))
170 return; 170 return;
171 171
172 AllocationContextTracker::SetCaptureEnabled(true); 172 std::string profiling_mode = CommandLine::ForCurrentProcess()
173 ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
174 AllocationContextTracker::SetCaptureMode(
175 profiling_mode == switches::kEnableHeapProfilingModeNative ?
176 AllocationContextTracker::CAPTURE_NATIVE_STACK :
177 AllocationContextTracker::CAPTURE_PSEUDO_STACK);
178
173 for (auto mdp : dump_providers_) 179 for (auto mdp : dump_providers_)
174 mdp->dump_provider->OnHeapProfilingEnabled(true); 180 mdp->dump_provider->OnHeapProfilingEnabled(true);
175 heap_profiling_enabled_ = true; 181 heap_profiling_enabled_ = true;
176 } 182 }
177 183
178 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, 184 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
179 bool is_coordinator) { 185 bool is_coordinator) {
180 { 186 {
181 AutoLock lock(lock_); 187 AutoLock lock(lock_);
182 DCHECK(delegate); 188 DCHECK(delegate);
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 if (iter == process_dumps.end()) { 759 if (iter == process_dumps.end()) {
754 std::unique_ptr<ProcessMemoryDump> new_pmd( 760 std::unique_ptr<ProcessMemoryDump> new_pmd(
755 new ProcessMemoryDump(session_state)); 761 new ProcessMemoryDump(session_state));
756 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 762 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
757 } 763 }
758 return iter->second.get(); 764 return iter->second.get();
759 } 765 }
760 766
761 } // namespace trace_event 767 } // namespace trace_event
762 } // namespace base 768 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698