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/allocator/features.h" | 10 #include "base/allocator/features.h" |
11 #include "base/atomic_sequence_num.h" | 11 #include "base/atomic_sequence_num.h" |
12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/debug/debugging_flags.h" | 15 #include "base/debug/debugging_flags.h" |
16 #include "base/debug/stack_trace.h" | 16 #include "base/debug/stack_trace.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
20 #include "base/trace_event/heap_profiler.h" | 20 #include "base/trace_event/heap_profiler.h" |
21 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 21 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 22 #include "base/trace_event/heap_profiler_event_filter.h" |
22 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 23 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
23 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" | 24 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" |
24 #include "base/trace_event/malloc_dump_provider.h" | 25 #include "base/trace_event/malloc_dump_provider.h" |
25 #include "base/trace_event/memory_dump_provider.h" | 26 #include "base/trace_event/memory_dump_provider.h" |
26 #include "base/trace_event/memory_dump_session_state.h" | 27 #include "base/trace_event/memory_dump_session_state.h" |
27 #include "base/trace_event/memory_infra_background_whitelist.h" | 28 #include "base/trace_event/memory_infra_background_whitelist.h" |
28 #include "base/trace_event/process_memory_dump.h" | 29 #include "base/trace_event/process_memory_dump.h" |
29 #include "base/trace_event/trace_event.h" | 30 #include "base/trace_event/trace_event.h" |
30 #include "base/trace_event/trace_event_argument.h" | 31 #include "base/trace_event/trace_event_argument.h" |
31 #include "build/build_config.h" | 32 #include "build/build_config.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory); | 205 TRACE_EVENT_WARMUP_CATEGORY(kTraceCategory); |
205 | 206 |
206 // TODO(ssid): This should be done in EnableHeapProfiling so that we capture | 207 // TODO(ssid): This should be done in EnableHeapProfiling so that we capture |
207 // more allocations (crbug.com/625170). | 208 // more allocations (crbug.com/625170). |
208 if (AllocationContextTracker::capture_mode() == | 209 if (AllocationContextTracker::capture_mode() == |
209 AllocationContextTracker::CaptureMode::PSEUDO_STACK && | 210 AllocationContextTracker::CaptureMode::PSEUDO_STACK && |
210 !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) { | 211 !(TraceLog::GetInstance()->enabled_modes() & TraceLog::FILTERING_MODE)) { |
211 // Create trace config with heap profiling filter. | 212 // Create trace config with heap profiling filter. |
212 TraceConfig::EventFilterConfig heap_profiler_filter_config( | 213 TraceConfig::EventFilterConfig heap_profiler_filter_config( |
213 TraceLog::TraceEventFilter::kHeapProfilerPredicate); | 214 HeapProfilerEventFilter::kName); |
214 heap_profiler_filter_config.AddIncludedCategory("*"); | 215 heap_profiler_filter_config.AddIncludedCategory("*"); |
215 heap_profiler_filter_config.AddIncludedCategory( | 216 heap_profiler_filter_config.AddIncludedCategory( |
216 MemoryDumpManager::kTraceCategory); | 217 MemoryDumpManager::kTraceCategory); |
217 TraceConfig::EventFilters filters; | 218 TraceConfig::EventFilters filters; |
218 filters.push_back(heap_profiler_filter_config); | 219 filters.push_back(heap_profiler_filter_config); |
219 TraceConfig filtering_trace_config; | 220 TraceConfig filtering_trace_config; |
220 filtering_trace_config.SetEventFilters(filters); | 221 filtering_trace_config.SetEventFilters(filters); |
221 | 222 |
222 TraceLog::GetInstance()->SetEnabled(filtering_trace_config, | 223 TraceLog::GetInstance()->SetEnabled(filtering_trace_config, |
223 TraceLog::FILTERING_MODE); | 224 TraceLog::FILTERING_MODE); |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) | 889 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) |
889 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; | 890 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; |
890 ++periodic_dumps_count_; | 891 ++periodic_dumps_count_; |
891 | 892 |
892 MemoryDumpManager::GetInstance()->RequestGlobalDump( | 893 MemoryDumpManager::GetInstance()->RequestGlobalDump( |
893 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); | 894 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); |
894 } | 895 } |
895 | 896 |
896 } // namespace trace_event | 897 } // namespace trace_event |
897 } // namespace base | 898 } // namespace base |
OLD | NEW |