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

Side by Side Diff: base/trace_event/trace_config.h

Issue 1923533004: Tracing pre-filtering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 4 years, 4 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 | « no previous file | base/trace_event/trace_config.cc » ('j') | base/trace_event/trace_config.cc » ('J')
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 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_CONFIG_H_
6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_ 6 #define BASE_TRACE_EVENT_TRACE_CONFIG_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // Set of memory dump modes allowed for the tracing session. The explicitly 74 // Set of memory dump modes allowed for the tracing session. The explicitly
75 // triggered dumps will be successful only if the dump mode is allowed in 75 // triggered dumps will be successful only if the dump mode is allowed in
76 // the config. 76 // the config.
77 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes; 77 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes;
78 78
79 std::vector<Trigger> triggers; 79 std::vector<Trigger> triggers;
80 HeapProfiler heap_profiler_options; 80 HeapProfiler heap_profiler_options;
81 }; 81 };
82 82
83 class EventFilterConfig {
84 public:
85 EventFilterConfig(const std::string& predicate_name);
86 ~EventFilterConfig();
87
88 EventFilterConfig(const EventFilterConfig& tc);
shatch 2016/08/15 21:25:47 nit: Kinda weird order with constructor/destructor
oystein (OOO til 10th of July) 2016/08/16 22:17:52 Done.
89 EventFilterConfig& operator=(const EventFilterConfig& rhs);
90
91 void AddIncludedCategory(const std::string& category);
92 void AddExcludedCategory(const std::string& category);
93 void SetArgs(std::unique_ptr<base::DictionaryValue> args);
94
95 bool IsCategoryGroupEnabled(const char* category_group_name) const;
96
97 const std::string& predicate_name() const { return predicate_name_; }
98 base::DictionaryValue* filter_args() const { return args_.get(); }
99 const StringList& included_categories() const {
100 return included_categories_;
101 }
102 const StringList& excluded_categories() const {
103 return excluded_categories_;
104 }
105
106 private:
107 std::string predicate_name_;
108 StringList included_categories_;
109 StringList excluded_categories_;
110 std::unique_ptr<base::DictionaryValue> args_;
111 };
112 typedef std::vector<EventFilterConfig> EventFilters;
113
83 TraceConfig(); 114 TraceConfig();
84 115
85 // Create TraceConfig object from category filter and trace options strings. 116 // Create TraceConfig object from category filter and trace options strings.
86 // 117 //
87 // |category_filter_string| is a comma-delimited list of category wildcards. 118 // |category_filter_string| is a comma-delimited list of category wildcards.
88 // A category can have an optional '-' prefix to make it an excluded category. 119 // A category can have an optional '-' prefix to make it an excluded category.
89 // All the same rules apply above, so for example, having both included and 120 // All the same rules apply above, so for example, having both included and
90 // excluded categories in the same list would not be supported. 121 // excluded categories in the same list would not be supported.
91 // 122 //
92 // Category filters can also be used to configure synthetic delays. 123 // Category filters can also be used to configure synthetic delays.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 220
190 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat 221 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat
191 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; 222 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const;
192 223
193 // Write the string representation of the CategoryFilter part. 224 // Write the string representation of the CategoryFilter part.
194 std::string ToCategoryFilterString() const; 225 std::string ToCategoryFilterString() const;
195 226
196 // Returns true if at least one category in the list is enabled by this 227 // Returns true if at least one category in the list is enabled by this
197 // trace config. This is used to determine if the category filters are 228 // trace config. This is used to determine if the category filters are
198 // enabled in the TRACE_* macros. 229 // enabled in the TRACE_* macros.
199 bool IsCategoryGroupEnabled(const char* category_group) const; 230 bool IsCategoryGroupEnabled(const char* category_group_name) const;
200 231
201 // Merges config with the current TraceConfig 232 // Merges config with the current TraceConfig
202 void Merge(const TraceConfig& config); 233 void Merge(const TraceConfig& config);
203 234
204 void Clear(); 235 void Clear();
205 236
206 // Clears and resets the memory dump config. 237 // Clears and resets the memory dump config.
207 void ResetMemoryDumpConfig(const MemoryDumpConfig& memory_dump_config); 238 void ResetMemoryDumpConfig(const MemoryDumpConfig& memory_dump_config);
208 239
209 const MemoryDumpConfig& memory_dump_config() const { 240 const MemoryDumpConfig& memory_dump_config() const {
210 return memory_dump_config_; 241 return memory_dump_config_;
211 } 242 }
212 243
244 const EventFilters& event_filters() const { return event_filters_; }
245
213 private: 246 private:
214 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); 247 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat);
215 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, 248 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
216 TraceConfigFromInvalidLegacyStrings); 249 TraceConfigFromInvalidLegacyStrings);
217 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); 250 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString);
218 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); 251 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString);
219 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, 252 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
220 IsEmptyOrContainsLeadingOrTrailingWhitespace); 253 IsEmptyOrContainsLeadingOrTrailingWhitespace);
221 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); 254 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString);
222 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); 255 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig);
(...skipping 20 matching lines...) Expand all
243 void SetCategoriesFromExcludedList(const ListValue& excluded_list); 276 void SetCategoriesFromExcludedList(const ListValue& excluded_list);
244 void SetSyntheticDelaysFromList(const ListValue& list); 277 void SetSyntheticDelaysFromList(const ListValue& list);
245 void AddCategoryToDict(DictionaryValue* dict, 278 void AddCategoryToDict(DictionaryValue* dict,
246 const char* param, 279 const char* param,
247 const StringList& categories) const; 280 const StringList& categories) const;
248 281
249 void SetMemoryDumpConfigFromConfigDict( 282 void SetMemoryDumpConfigFromConfigDict(
250 const DictionaryValue& memory_dump_config); 283 const DictionaryValue& memory_dump_config);
251 void SetDefaultMemoryDumpConfig(); 284 void SetDefaultMemoryDumpConfig();
252 285
286 void SetEventFilters(const base::ListValue& event_filters);
253 std::unique_ptr<DictionaryValue> ToDict() const; 287 std::unique_ptr<DictionaryValue> ToDict() const;
254 288
255 std::string ToTraceOptionsString() const; 289 std::string ToTraceOptionsString() const;
256 290
257 void WriteCategoryFilterString(const StringList& values, 291 void WriteCategoryFilterString(const StringList& values,
258 std::string* out, 292 std::string* out,
259 bool included) const; 293 bool included) const;
260 void WriteCategoryFilterString(const StringList& delays, 294 void WriteCategoryFilterString(const StringList& delays,
261 std::string* out) const; 295 std::string* out) const;
262 296
(...skipping 11 matching lines...) Expand all
274 bool enable_sampling_ : 1; 308 bool enable_sampling_ : 1;
275 bool enable_systrace_ : 1; 309 bool enable_systrace_ : 1;
276 bool enable_argument_filter_ : 1; 310 bool enable_argument_filter_ : 1;
277 311
278 MemoryDumpConfig memory_dump_config_; 312 MemoryDumpConfig memory_dump_config_;
279 313
280 StringList included_categories_; 314 StringList included_categories_;
281 StringList disabled_categories_; 315 StringList disabled_categories_;
282 StringList excluded_categories_; 316 StringList excluded_categories_;
283 StringList synthetic_delays_; 317 StringList synthetic_delays_;
318 EventFilters event_filters_;
284 }; 319 };
285 320
286 } // namespace trace_event 321 } // namespace trace_event
287 } // namespace base 322 } // namespace base
288 323
289 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ 324 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_config.cc » ('j') | base/trace_event/trace_config.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698