| 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 <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" |
| 11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 16 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 17 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 17 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
| 18 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" | 18 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" |
| 19 #include "base/trace_event/malloc_dump_provider.h" | 19 #include "base/trace_event/malloc_dump_provider.h" |
| 20 #include "base/trace_event/memory_dump_provider.h" | 20 #include "base/trace_event/memory_dump_provider.h" |
| 21 #include "base/trace_event/memory_dump_session_state.h" | 21 #include "base/trace_event/memory_dump_session_state.h" |
| 22 #include "base/trace_event/process_memory_dump.h" | 22 #include "base/trace_event/process_memory_dump.h" |
| 23 #include "base/trace_event/trace_event_argument.h" | 23 #include "base/trace_event/trace_event_argument.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 | 25 |
| 26 #if !defined(OS_NACL) | |
| 27 #include "base/trace_event/process_memory_totals_dump_provider.h" | |
| 28 #endif | |
| 29 | |
| 30 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
| 31 #include "base/trace_event/process_memory_maps_dump_provider.h" | |
| 32 #endif | |
| 33 | |
| 34 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
| 35 #include "base/trace_event/java_heap_dump_provider_android.h" | 27 #include "base/trace_event/java_heap_dump_provider_android.h" |
| 36 #endif | 28 #endif |
| 37 | 29 |
| 38 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 39 #include "base/trace_event/winheap_dump_provider_win.h" | 31 #include "base/trace_event/winheap_dump_provider_win.h" |
| 40 #endif | 32 #endif |
| 41 | 33 |
| 42 namespace base { | 34 namespace base { |
| 43 namespace trace_event { | 35 namespace trace_event { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 bool is_coordinator) { | 138 bool is_coordinator) { |
| 147 { | 139 { |
| 148 AutoLock lock(lock_); | 140 AutoLock lock(lock_); |
| 149 DCHECK(delegate); | 141 DCHECK(delegate); |
| 150 DCHECK(!delegate_); | 142 DCHECK(!delegate_); |
| 151 delegate_ = delegate; | 143 delegate_ = delegate; |
| 152 is_coordinator_ = is_coordinator; | 144 is_coordinator_ = is_coordinator; |
| 153 } | 145 } |
| 154 | 146 |
| 155 // Enable the core dump providers. | 147 // Enable the core dump providers. |
| 156 #if !defined(OS_NACL) | |
| 157 RegisterDumpProvider(ProcessMemoryTotalsDumpProvider::GetInstance(), | |
| 158 "ProcessMemoryTotals", nullptr); | |
| 159 #endif | |
| 160 | |
| 161 #if defined(MALLOC_MEMORY_TRACING_SUPPORTED) | 148 #if defined(MALLOC_MEMORY_TRACING_SUPPORTED) |
| 162 RegisterDumpProvider(MallocDumpProvider::GetInstance(), "Malloc", nullptr); | 149 RegisterDumpProvider(MallocDumpProvider::GetInstance(), "Malloc", nullptr); |
| 163 #endif | 150 #endif |
| 164 | 151 |
| 165 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
| 166 RegisterDumpProvider(ProcessMemoryMapsDumpProvider::GetInstance(), | |
| 167 "ProcessMemoryMaps", nullptr); | |
| 168 #endif | |
| 169 | |
| 170 #if defined(OS_ANDROID) | 152 #if defined(OS_ANDROID) |
| 171 RegisterDumpProvider(JavaHeapDumpProvider::GetInstance(), "JavaHeap", | 153 RegisterDumpProvider(JavaHeapDumpProvider::GetInstance(), "JavaHeap", |
| 172 nullptr); | 154 nullptr); |
| 173 #endif | 155 #endif |
| 174 | 156 |
| 175 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
| 176 RegisterDumpProvider(WinHeapDumpProvider::GetInstance(), "WinHeap", nullptr); | 158 RegisterDumpProvider(WinHeapDumpProvider::GetInstance(), "WinHeap", nullptr); |
| 177 #endif | 159 #endif |
| 178 | 160 |
| 179 // If tracing was enabled before initializing MemoryDumpManager, we missed the | 161 // If tracing was enabled before initializing MemoryDumpManager, we missed the |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 auto iter = process_dumps.find(pid); | 639 auto iter = process_dumps.find(pid); |
| 658 if (iter == process_dumps.end()) { | 640 if (iter == process_dumps.end()) { |
| 659 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); | 641 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); |
| 660 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 642 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 661 } | 643 } |
| 662 return iter->second.get(); | 644 return iter->second.get(); |
| 663 } | 645 } |
| 664 | 646 |
| 665 } // namespace trace_event | 647 } // namespace trace_event |
| 666 } // namespace base | 648 } // namespace base |
| OLD | NEW |