| 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" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 AllocationContextTracker::CaptureMode::PSEUDO_STACK); | 159 AllocationContextTracker::CaptureMode::PSEUDO_STACK); |
| 160 } | 160 } |
| 161 else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { | 161 else if (profiling_mode == switches::kEnableHeapProfilingModeNative) { |
| 162 #if HAVE_TRACE_STACK_FRAME_POINTERS && \ | 162 #if HAVE_TRACE_STACK_FRAME_POINTERS && \ |
| 163 (BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)) | 163 (BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG)) |
| 164 // We need frame pointers for native tracing to work, and they are | 164 // We need frame pointers for native tracing to work, and they are |
| 165 // enabled in profiling and debug builds. | 165 // enabled in profiling and debug builds. |
| 166 AllocationContextTracker::SetCaptureMode( | 166 AllocationContextTracker::SetCaptureMode( |
| 167 AllocationContextTracker::CaptureMode::NATIVE_STACK); | 167 AllocationContextTracker::CaptureMode::NATIVE_STACK); |
| 168 #else | 168 #else |
| 169 CHECK(false) << "'" << profiling_mode << "' mode for " | 169 CHECK(false); |
| 170 << switches::kEnableHeapProfiling << " flag is not supported " | |
| 171 << "for this platform / build type."; | |
| 172 #endif | 170 #endif |
| 173 } else { | 171 } else { |
| 174 CHECK(false) << "Invalid mode '" << profiling_mode << "' for " | 172 CHECK(false); |
| 175 << switches::kEnableHeapProfiling << " flag."; | |
| 176 } | 173 } |
| 177 | 174 |
| 178 for (auto mdp : dump_providers_) | 175 for (auto mdp : dump_providers_) |
| 179 mdp->dump_provider->OnHeapProfilingEnabled(true); | 176 mdp->dump_provider->OnHeapProfilingEnabled(true); |
| 180 heap_profiling_enabled_ = true; | 177 heap_profiling_enabled_ = true; |
| 181 } | 178 } |
| 182 | 179 |
| 183 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, | 180 void MemoryDumpManager::Initialize(MemoryDumpManagerDelegate* delegate, |
| 184 bool is_coordinator) { | 181 bool is_coordinator) { |
| 185 { | 182 { |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) | 885 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) |
| 889 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; | 886 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; |
| 890 ++periodic_dumps_count_; | 887 ++periodic_dumps_count_; |
| 891 | 888 |
| 892 MemoryDumpManager::GetInstance()->RequestGlobalDump( | 889 MemoryDumpManager::GetInstance()->RequestGlobalDump( |
| 893 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); | 890 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); |
| 894 } | 891 } |
| 895 | 892 |
| 896 } // namespace trace_event | 893 } // namespace trace_event |
| 897 } // namespace base | 894 } // namespace base |
| OLD | NEW |