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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 return; | 647 return; |
648 } | 648 } |
649 | 649 |
650 // Enable periodic dumps. At the moment the periodic support is limited to at | 650 // Enable periodic dumps. At the moment the periodic support is limited to at |
651 // most one low-detail periodic dump and at most one high-detail periodic | 651 // most one low-detail periodic dump and at most one high-detail periodic |
652 // dump. If both are specified the high-detail period must be an integer | 652 // dump. If both are specified the high-detail period must be an integer |
653 // multiple of the low-level one. | 653 // multiple of the low-level one. |
654 g_periodic_dumps_count = 0; | 654 g_periodic_dumps_count = 0; |
655 const TraceConfig trace_config = | 655 const TraceConfig trace_config = |
656 TraceLog::GetInstance()->GetCurrentTraceConfig(); | 656 TraceLog::GetInstance()->GetCurrentTraceConfig(); |
657 const TraceConfig::MemoryDumpConfig& config_list = | 657 session_state_->SetMemoryDumpConfig(trace_config.memory_dump_config()); |
658 trace_config.memory_dump_config(); | 658 std::vector<TraceConfig::MemoryDumpTriggerConfig> triggers_list = |
Primiano Tucci (use gerrit)
2016/04/22 14:18:29
can this still be a const& reference instead of co
Maria
2016/04/25 18:37:23
Done.
| |
659 if (config_list.empty()) | 659 trace_config.memory_dump_config().triggers; |
660 if (triggers_list.empty()) | |
660 return; | 661 return; |
661 | 662 |
662 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max(); | 663 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max(); |
663 uint32_t heavy_dump_period_ms = 0; | 664 uint32_t heavy_dump_period_ms = 0; |
664 DCHECK_LE(config_list.size(), 2u); | 665 DCHECK_LE(triggers_list.size(), 2u); |
665 for (const TraceConfig::MemoryDumpTriggerConfig& config : config_list) { | 666 for (const TraceConfig::MemoryDumpTriggerConfig& config : triggers_list) { |
666 DCHECK(config.periodic_interval_ms); | 667 DCHECK(config.periodic_interval_ms); |
667 if (config.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) | 668 if (config.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) |
668 heavy_dump_period_ms = config.periodic_interval_ms; | 669 heavy_dump_period_ms = config.periodic_interval_ms; |
669 min_timer_period_ms = | 670 min_timer_period_ms = |
670 std::min(min_timer_period_ms, config.periodic_interval_ms); | 671 std::min(min_timer_period_ms, config.periodic_interval_ms); |
671 } | 672 } |
672 DCHECK_EQ(0u, heavy_dump_period_ms % min_timer_period_ms); | 673 DCHECK_EQ(0u, heavy_dump_period_ms % min_timer_period_ms); |
673 g_heavy_dumps_rate = heavy_dump_period_ms / min_timer_period_ms; | 674 g_heavy_dumps_rate = heavy_dump_period_ms / min_timer_period_ms; |
674 | 675 |
675 periodic_dump_timer_.Start(FROM_HERE, | 676 periodic_dump_timer_.Start(FROM_HERE, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 if (iter == process_dumps.end()) { | 752 if (iter == process_dumps.end()) { |
752 std::unique_ptr<ProcessMemoryDump> new_pmd( | 753 std::unique_ptr<ProcessMemoryDump> new_pmd( |
753 new ProcessMemoryDump(session_state)); | 754 new ProcessMemoryDump(session_state)); |
754 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 755 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
755 } | 756 } |
756 return iter->second.get(); | 757 return iter->second.get(); |
757 } | 758 } |
758 | 759 |
759 } // namespace trace_event | 760 } // namespace trace_event |
760 } // namespace base | 761 } // namespace base |
OLD | NEW |