Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 1911643002: Add configurable limit to allocations in heap profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Whitespace change Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_session_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 return; 675 return;
676 } 676 }
677 677
678 // Enable periodic dumps. At the moment the periodic support is limited to at 678 // Enable periodic dumps. At the moment the periodic support is limited to at
679 // most one low-detail periodic dump and at most one high-detail periodic 679 // most one low-detail periodic dump and at most one high-detail periodic
680 // dump. If both are specified the high-detail period must be an integer 680 // dump. If both are specified the high-detail period must be an integer
681 // multiple of the low-level one. 681 // multiple of the low-level one.
682 g_periodic_dumps_count = 0; 682 g_periodic_dumps_count = 0;
683 const TraceConfig trace_config = 683 const TraceConfig trace_config =
684 TraceLog::GetInstance()->GetCurrentTraceConfig(); 684 TraceLog::GetInstance()->GetCurrentTraceConfig();
685 const TraceConfig::MemoryDumpConfig& config_list = 685 session_state_->SetMemoryDumpConfig(trace_config.memory_dump_config());
686 trace_config.memory_dump_config(); 686 const std::vector<TraceConfig::MemoryDumpConfig::Trigger>& triggers_list =
687 if (config_list.empty()) 687 trace_config.memory_dump_config().triggers;
688 if (triggers_list.empty())
688 return; 689 return;
689 690
690 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max(); 691 uint32_t min_timer_period_ms = std::numeric_limits<uint32_t>::max();
691 uint32_t heavy_dump_period_ms = 0; 692 uint32_t heavy_dump_period_ms = 0;
692 DCHECK_LE(config_list.size(), 2u); 693 DCHECK_LE(triggers_list.size(), 2u);
693 for (const TraceConfig::MemoryDumpTriggerConfig& config : config_list) { 694 for (const TraceConfig::MemoryDumpConfig::Trigger& config : triggers_list) {
694 DCHECK(config.periodic_interval_ms); 695 DCHECK(config.periodic_interval_ms);
695 if (config.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) 696 if (config.level_of_detail == MemoryDumpLevelOfDetail::DETAILED)
696 heavy_dump_period_ms = config.periodic_interval_ms; 697 heavy_dump_period_ms = config.periodic_interval_ms;
697 min_timer_period_ms = 698 min_timer_period_ms =
698 std::min(min_timer_period_ms, config.periodic_interval_ms); 699 std::min(min_timer_period_ms, config.periodic_interval_ms);
699 } 700 }
700 DCHECK_EQ(0u, heavy_dump_period_ms % min_timer_period_ms); 701 DCHECK_EQ(0u, heavy_dump_period_ms % min_timer_period_ms);
701 g_heavy_dumps_rate = heavy_dump_period_ms / min_timer_period_ms; 702 g_heavy_dumps_rate = heavy_dump_period_ms / min_timer_period_ms;
702 703
703 periodic_dump_timer_.Start(FROM_HERE, 704 periodic_dump_timer_.Start(FROM_HERE,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 if (iter == process_dumps.end()) { 780 if (iter == process_dumps.end()) {
780 std::unique_ptr<ProcessMemoryDump> new_pmd( 781 std::unique_ptr<ProcessMemoryDump> new_pmd(
781 new ProcessMemoryDump(session_state)); 782 new ProcessMemoryDump(session_state));
782 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 783 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
783 } 784 }
784 return iter->second.get(); 785 return iter->second.get();
785 } 786 }
786 787
787 } // namespace trace_event 788 } // namespace trace_event
788 } // namespace base 789 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/malloc_dump_provider.cc ('k') | base/trace_event/memory_dump_session_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698