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

Unified Diff: base/trace_event/trace_config.cc

Issue 1911643002: Add configurable limit to allocations in heap profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting changes Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« base/trace_event/trace_config.h ('K') | « base/trace_event/trace_config.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_config.cc
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index e9e5a099893377e844be716845b0bbcfe90a2639..d7a7fbae155b1a64a88d2cd2e7f258e20ad56802 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -50,6 +50,7 @@ const char kMemoryDumpConfigParam[] = "memory_dump_config";
const char kTriggersParam[] = "triggers";
const char kPeriodicIntervalParam[] = "periodic_interval_ms";
const char kModeParam[] = "mode";
+const char kMinAllocationSize[] = "min_allocation_size_bytes";
ssid 2016/04/20 23:00:30 heap_profiler_min_bucket_size. Since min allocatio
Maria 2016/04/21 00:03:56 Acknowledged.
// Default configuration of memory dumps.
const TraceConfig::MemoryDumpTriggerConfig kDefaultHeavyMemoryDumpTrigger = {
@@ -123,6 +124,7 @@ TraceConfig::TraceConfig(const TraceConfig& tc)
enable_systrace_(tc.enable_systrace_),
enable_argument_filter_(tc.enable_argument_filter_),
memory_dump_config_(tc.memory_dump_config_),
+ min_allocation_size_bytes_(tc.min_allocation_size_bytes_),
included_categories_(tc.included_categories_),
disabled_categories_(tc.disabled_categories_),
excluded_categories_(tc.excluded_categories_),
@@ -140,6 +142,7 @@ TraceConfig& TraceConfig::operator=(const TraceConfig& rhs) {
enable_systrace_ = rhs.enable_systrace_;
enable_argument_filter_ = rhs.enable_argument_filter_;
memory_dump_config_ = rhs.memory_dump_config_;
+ min_allocation_size_bytes_ = rhs.min_allocation_size_bytes_;
included_categories_ = rhs.included_categories_;
disabled_categories_ = rhs.disabled_categories_;
excluded_categories_ = rhs.excluded_categories_;
@@ -516,12 +519,24 @@ void TraceConfig::SetMemoryDumpConfig(
StringToMemoryDumpLevelOfDetail(level_of_detail_str);
memory_dump_config_.push_back(dump_config);
}
+
+ int min_size_bytes = 0;
+ if (!memory_dump_config.GetInteger(kMinAllocationSize, &min_size_bytes)) {
+ min_allocation_size_bytes_ = kDefaultMinAllocationSizeBytes;
+ } else {
+ if (min_size_bytes >= 0)
ssid 2016/04/20 23:00:30 merge with above else, reduces one block. Also th
Maria 2016/04/21 00:03:56 Done.
+ min_allocation_size_bytes_ = (size_t) min_size_bytes;
+ else
+ min_allocation_size_bytes_ = kDefaultMinAllocationSizeBytes;
+ }
+
}
void TraceConfig::SetDefaultMemoryDumpConfig() {
memory_dump_config_.clear();
memory_dump_config_.push_back(kDefaultHeavyMemoryDumpTrigger);
memory_dump_config_.push_back(kDefaultLightMemoryDumpTrigger);
+ min_allocation_size_bytes_ = kDefaultMinAllocationSizeBytes;
}
void TraceConfig::ToDict(base::DictionaryValue& dict) const {
« base/trace_event/trace_config.h ('K') | « base/trace_event/trace_config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698