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

Unified Diff: base/trace_event/trace_config.cc

Issue 2323483005: [tracing] Add filtering mode in TraceLog (Closed)
Patch Set: SetEnabled takes a bitmap. Created 4 years, 2 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
Index: base/trace_event/trace_config.cc
diff --git a/base/trace_event/trace_config.cc b/base/trace_event/trace_config.cc
index fdeb3294179ab6279edf22e5ce1a792b16b886d8..e6655d47ff0eec10f5a1031eff992ceb347c4471 100644
--- a/base/trace_event/trace_config.cc
+++ b/base/trace_event/trace_config.cc
@@ -119,6 +119,17 @@ void TraceConfig::MemoryDumpConfig::Clear() {
heap_profiler_options.Clear();
}
+void TraceConfig::MemoryDumpConfig::Merge(
Primiano Tucci (use gerrit) 2016/10/12 17:50:17 just to be clear, this is an indipendent fix? It w
ssid 2016/10/12 19:04:43 Yes independent since i just realized Merge is bei
+ const TraceConfig::MemoryDumpConfig& config) {
+ triggers.insert(triggers.end(), config.triggers.begin(),
+ config.triggers.end());
+ allowed_dump_modes.insert(config.allowed_dump_modes.begin(),
+ config.allowed_dump_modes.end());
+ heap_profiler_options.breakdown_threshold_bytes =
+ std::min(heap_profiler_options.breakdown_threshold_bytes,
+ config.heap_profiler_options.breakdown_threshold_bytes);
+}
+
TraceConfig::EventFilterConfig::EventFilterConfig(
const std::string& predicate_name)
: predicate_name_(predicate_name) {}
@@ -355,9 +366,7 @@ void TraceConfig::Merge(const TraceConfig& config) {
included_categories_.clear();
}
- memory_dump_config_.triggers.insert(memory_dump_config_.triggers.end(),
- config.memory_dump_config_.triggers.begin(),
- config.memory_dump_config_.triggers.end());
+ memory_dump_config_.Merge(config.memory_dump_config_);
disabled_categories_.insert(disabled_categories_.end(),
config.disabled_categories_.begin(),
@@ -368,6 +377,8 @@ void TraceConfig::Merge(const TraceConfig& config) {
synthetic_delays_.insert(synthetic_delays_.end(),
config.synthetic_delays_.begin(),
config.synthetic_delays_.end());
+ event_filters_.insert(event_filters_.end(), config.event_filters().begin(),
+ config.event_filters().end());
}
void TraceConfig::Clear() {
@@ -416,6 +427,10 @@ void TraceConfig::InitializeFromConfigDict(const DictionaryValue& dict) {
if (dict.GetList(kSyntheticDelaysParam, &category_list))
SetSyntheticDelaysFromList(*category_list);
+ const base::ListValue* category_event_filters = nullptr;
+ if (dict.GetList(kEventFiltersParam, &category_event_filters))
+ SetEventFilters(*category_event_filters);
+
if (IsCategoryEnabled(MemoryDumpManager::kTraceCategory)) {
// If dump triggers not set, the client is using the legacy with just
// category enabled. So, use the default periodic dump config.
@@ -425,10 +440,6 @@ void TraceConfig::InitializeFromConfigDict(const DictionaryValue& dict) {
else
SetDefaultMemoryDumpConfig();
}
-
- const base::ListValue* category_event_filters = nullptr;
- if (dict.GetList(kEventFiltersParam, &category_event_filters))
- SetEventFilters(*category_event_filters);
}
void TraceConfig::InitializeFromConfigString(StringPiece config_string) {
@@ -618,22 +629,6 @@ void TraceConfig::SetDefaultMemoryDumpConfig() {
memory_dump_config_.triggers.push_back(kDefaultHeavyMemoryDumpTrigger);
memory_dump_config_.triggers.push_back(kDefaultLightMemoryDumpTrigger);
memory_dump_config_.allowed_dump_modes = GetDefaultAllowedMemoryDumpModes();
-
- if (AllocationContextTracker::capture_mode() ==
- AllocationContextTracker::CaptureMode::PSEUDO_STACK) {
- for (const auto& filter : event_filters_) {
- if (filter.predicate_name() ==
- TraceLog::TraceEventFilter::kHeapProfilerPredicate)
- return;
- }
- // Adds a filter predicate to filter all categories for the heap profiler.
- // Note that the heap profiler predicate does not filter-out any events.
- EventFilterConfig heap_profiler_config(
- TraceLog::TraceEventFilter::kHeapProfilerPredicate);
- heap_profiler_config.AddIncludedCategory("*");
- heap_profiler_config.AddIncludedCategory(MemoryDumpManager::kTraceCategory);
- event_filters_.push_back(heap_profiler_config);
- }
}
void TraceConfig::SetEventFilters(

Powered by Google App Engine
This is Rietveld 408576698