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" |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return; | 818 return; |
819 | 819 |
820 // At the moment the periodic support is limited to at most one periodic | 820 // At the moment the periodic support is limited to at most one periodic |
821 // trigger per dump mode. All intervals should be an integer multiple of the | 821 // trigger per dump mode. All intervals should be an integer multiple of the |
822 // smallest interval specified. | 822 // smallest interval specified. |
823 periodic_dumps_count_ = 0; | 823 periodic_dumps_count_ = 0; |
824 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max(); | 824 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max(); |
825 uint32_t light_dump_period_ms = 0; | 825 uint32_t light_dump_period_ms = 0; |
826 uint32_t heavy_dump_period_ms = 0; | 826 uint32_t heavy_dump_period_ms = 0; |
827 DCHECK_LE(triggers_list.size(), 3u); | 827 DCHECK_LE(triggers_list.size(), 3u); |
828 auto mdm = MemoryDumpManager::GetInstance(); | 828 auto* mdm = MemoryDumpManager::GetInstance(); |
829 for (const TraceConfig::MemoryDumpConfig::Trigger& config : triggers_list) { | 829 for (const TraceConfig::MemoryDumpConfig::Trigger& config : triggers_list) { |
830 DCHECK_NE(0u, config.periodic_interval_ms); | 830 DCHECK_NE(0u, config.periodic_interval_ms); |
831 switch (config.level_of_detail) { | 831 switch (config.level_of_detail) { |
832 case MemoryDumpLevelOfDetail::BACKGROUND: | 832 case MemoryDumpLevelOfDetail::BACKGROUND: |
833 DCHECK(mdm->IsDumpModeAllowed(MemoryDumpLevelOfDetail::BACKGROUND)); | 833 DCHECK(mdm->IsDumpModeAllowed(MemoryDumpLevelOfDetail::BACKGROUND)); |
834 break; | 834 break; |
835 case MemoryDumpLevelOfDetail::LIGHT: | 835 case MemoryDumpLevelOfDetail::LIGHT: |
836 DCHECK_EQ(0u, light_dump_period_ms); | 836 DCHECK_EQ(0u, light_dump_period_ms); |
837 DCHECK(mdm->IsDumpModeAllowed(MemoryDumpLevelOfDetail::LIGHT)); | 837 DCHECK(mdm->IsDumpModeAllowed(MemoryDumpLevelOfDetail::LIGHT)); |
838 light_dump_period_ms = config.periodic_interval_ms; | 838 light_dump_period_ms = config.periodic_interval_ms; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) | 874 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) |
875 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; | 875 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; |
876 ++periodic_dumps_count_; | 876 ++periodic_dumps_count_; |
877 | 877 |
878 MemoryDumpManager::GetInstance()->RequestGlobalDump( | 878 MemoryDumpManager::GetInstance()->RequestGlobalDump( |
879 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); | 879 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); |
880 } | 880 } |
881 | 881 |
882 } // namespace trace_event | 882 } // namespace trace_event |
883 } // namespace base | 883 } // namespace base |
OLD | NEW |