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