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

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

Issue 1916033002: Revert of [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 void MemoryDumpManager::EnableHeapProfilingIfNeeded() { 164 void MemoryDumpManager::EnableHeapProfilingIfNeeded() {
165 if (heap_profiling_enabled_) 165 if (heap_profiling_enabled_)
166 return; 166 return;
167 167
168 if (!CommandLine::InitializedForCurrentProcess() || 168 if (!CommandLine::InitializedForCurrentProcess() ||
169 !CommandLine::ForCurrentProcess()->HasSwitch( 169 !CommandLine::ForCurrentProcess()->HasSwitch(
170 switches::kEnableHeapProfiling)) 170 switches::kEnableHeapProfiling))
171 return; 171 return;
172 172
173 std::string profiling_mode = CommandLine::ForCurrentProcess() 173 AllocationContextTracker::SetCaptureEnabled(true);
174 ->GetSwitchValueASCII(switches::kEnableHeapProfiling);
175 if (profiling_mode == "") {
176 AllocationContextTracker::SetCaptureMode(
177 AllocationContextTracker::CaptureMode::PSEUDO_STACK);
178 }
179 else if (profiling_mode == switches::kEnableHeapProfilingModeNative) {
180 #if ENABLE_NATIVE_ALLOCATION_TRACES
181 AllocationContextTracker::SetCaptureMode(
182 AllocationContextTracker::CaptureMode::NATIVE_STACK);
183 #else
184 CHECK(false) << "'" << profiling_mode << "' mode for "
185 << switches::kEnableHeapProfiling << " flag is not supported "
186 << "for this platform / build type.";
187 #endif
188 } else {
189 CHECK(false) << "Invalid mode '" << profiling_mode << "' for "
190 << switches::kEnableHeapProfiling << " flag.";
191 }
192
193 for (auto mdp : dump_providers_) 174 for (auto mdp : dump_providers_)
194 mdp->dump_provider->OnHeapProfilingEnabled(true); 175 mdp->dump_provider->OnHeapProfilingEnabled(true);
195 heap_profiling_enabled_ = true; 176 heap_profiling_enabled_ = true;
196 } 177 }
197 178
198 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, 179 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate,
199 bool is_coordinator) { 180 bool is_coordinator) {
200 { 181 {
201 AutoLock lock(lock_); 182 AutoLock lock(lock_);
202 DCHECK(delegate); 183 DCHECK(delegate);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (iter == process_dumps.end()) { 755 if (iter == process_dumps.end()) {
775 std::unique_ptr<ProcessMemoryDump> new_pmd( 756 std::unique_ptr<ProcessMemoryDump> new_pmd(
776 new ProcessMemoryDump(session_state)); 757 new ProcessMemoryDump(session_state));
777 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 758 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
778 } 759 }
779 return iter->second.get(); 760 return iter->second.get();
780 } 761 }
781 762
782 } // namespace trace_event 763 } // namespace trace_event
783 } // namespace base 764 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/heap_profiler_stack_frame_deduplicator.cc ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698