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 #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 <string> | 10 #include <string> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 uint32_t breakdown_threshold_bytes; | 66 uint32_t breakdown_threshold_bytes; |
67 }; | 67 }; |
68 | 68 |
69 // Reset the values in the config. | 69 // Reset the values in the config. |
70 void Clear(); | 70 void Clear(); |
71 | 71 |
72 std::vector<Trigger> triggers; | 72 std::vector<Trigger> triggers; |
73 HeapProfiler heap_profiler_options; | 73 HeapProfiler heap_profiler_options; |
74 }; | 74 }; |
75 | 75 |
76 class EventFilterConfig { | |
77 public: | |
78 EventFilterConfig(const std::string& predicate_name); | |
79 ~EventFilterConfig(); | |
80 | |
81 EventFilterConfig(const EventFilterConfig& tc); | |
82 EventFilterConfig& operator=(const EventFilterConfig& rhs); | |
83 | |
84 void AddIncludedCategory(const std::string& category); | |
85 void AddExcludedCategory(const std::string& category); | |
86 void SetArgs(std::unique_ptr<base::DictionaryValue> args); | |
Primiano Tucci (use gerrit)
2016/05/27 17:47:06
nit: you are in base, no need for base::
| |
87 | |
88 bool IsCategoryGroupEnabled(const char* category_group_name) const; | |
89 | |
90 const std::string& predicate_name() const { return predicate_name_; } | |
91 base::DictionaryValue* filter_args() const { return args_.get(); } | |
Primiano Tucci (use gerrit)
2016/05/27 17:47:06
maybe you want this to be a const DictValue*?
ditt
| |
92 const StringList& included_categories() const { | |
93 return included_categories_; | |
94 } | |
95 const StringList& excluded_categories() const { | |
96 return excluded_categories_; | |
97 } | |
98 | |
99 private: | |
100 std::string predicate_name_; | |
101 StringList included_categories_; | |
102 StringList excluded_categories_; | |
103 std::unique_ptr<base::DictionaryValue> args_; | |
104 }; | |
105 typedef std::vector<EventFilterConfig> EventFilters; | |
106 | |
76 TraceConfig(); | 107 TraceConfig(); |
77 | 108 |
78 // Create TraceConfig object from category filter and trace options strings. | 109 // Create TraceConfig object from category filter and trace options strings. |
79 // | 110 // |
80 // |category_filter_string| is a comma-delimited list of category wildcards. | 111 // |category_filter_string| is a comma-delimited list of category wildcards. |
81 // A category can have an optional '-' prefix to make it an excluded category. | 112 // A category can have an optional '-' prefix to make it an excluded category. |
82 // All the same rules apply above, so for example, having both included and | 113 // All the same rules apply above, so for example, having both included and |
83 // excluded categories in the same list would not be supported. | 114 // excluded categories in the same list would not be supported. |
84 // | 115 // |
85 // Category filters can also be used to configure synthetic delays. | 116 // Category filters can also be used to configure synthetic delays. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 std::string ToString() const; | 213 std::string ToString() const; |
183 | 214 |
184 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat | 215 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat |
185 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; | 216 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; |
186 | 217 |
187 // Write the string representation of the CategoryFilter part. | 218 // Write the string representation of the CategoryFilter part. |
188 std::string ToCategoryFilterString() const; | 219 std::string ToCategoryFilterString() const; |
189 | 220 |
190 // Returns true if at least one category in the list is enabled by this | 221 // Returns true if at least one category in the list is enabled by this |
191 // trace config. | 222 // trace config. |
192 bool IsCategoryGroupEnabled(const char* category_group) const; | 223 bool IsCategoryGroupEnabled(const char* category_group_name) const; |
193 | 224 |
194 // Merges config with the current TraceConfig | 225 // Merges config with the current TraceConfig |
195 void Merge(const TraceConfig& config); | 226 void Merge(const TraceConfig& config); |
196 | 227 |
197 void Clear(); | 228 void Clear(); |
198 | 229 |
199 const MemoryDumpConfig& memory_dump_config() const { | 230 const MemoryDumpConfig& memory_dump_config() const { |
200 return memory_dump_config_; | 231 return memory_dump_config_; |
201 } | 232 } |
202 | 233 |
234 const EventFilters& event_filters() const { return event_filters_; } | |
235 | |
203 private: | 236 private: |
204 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); | 237 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); |
205 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, | 238 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, |
206 TraceConfigFromInvalidLegacyStrings); | 239 TraceConfigFromInvalidLegacyStrings); |
207 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig); | 240 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig); |
208 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); | 241 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); |
209 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); | 242 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); |
210 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, | 243 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, |
211 IsEmptyOrContainsLeadingOrTrailingWhitespace); | 244 IsEmptyOrContainsLeadingOrTrailingWhitespace); |
212 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); | 245 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); |
(...skipping 18 matching lines...) Expand all Loading... | |
231 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 264 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
232 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 265 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
233 void SetSyntheticDelaysFromList(const base::ListValue& list); | 266 void SetSyntheticDelaysFromList(const base::ListValue& list); |
234 void AddCategoryToDict(base::DictionaryValue& dict, | 267 void AddCategoryToDict(base::DictionaryValue& dict, |
235 const char* param, | 268 const char* param, |
236 const StringList& categories) const; | 269 const StringList& categories) const; |
237 | 270 |
238 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); | 271 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); |
239 void SetDefaultMemoryDumpConfig(); | 272 void SetDefaultMemoryDumpConfig(); |
240 | 273 |
274 void SetEventFilters(const base::ListValue& event_filters); | |
275 | |
241 // Convert TraceConfig to the dict representation of the TraceConfig. | 276 // Convert TraceConfig to the dict representation of the TraceConfig. |
242 void ToDict(base::DictionaryValue& dict) const; | 277 void ToDict(base::DictionaryValue& dict) const; |
243 | 278 |
244 std::string ToTraceOptionsString() const; | 279 std::string ToTraceOptionsString() const; |
245 | 280 |
246 void WriteCategoryFilterString(const StringList& values, | 281 void WriteCategoryFilterString(const StringList& values, |
247 std::string* out, | 282 std::string* out, |
248 bool included) const; | 283 bool included) const; |
249 void WriteCategoryFilterString(const StringList& delays, | 284 void WriteCategoryFilterString(const StringList& delays, |
250 std::string* out) const; | 285 std::string* out) const; |
(...skipping 10 matching lines...) Expand all Loading... | |
261 bool enable_sampling_ : 1; | 296 bool enable_sampling_ : 1; |
262 bool enable_systrace_ : 1; | 297 bool enable_systrace_ : 1; |
263 bool enable_argument_filter_ : 1; | 298 bool enable_argument_filter_ : 1; |
264 | 299 |
265 MemoryDumpConfig memory_dump_config_; | 300 MemoryDumpConfig memory_dump_config_; |
266 | 301 |
267 StringList included_categories_; | 302 StringList included_categories_; |
268 StringList disabled_categories_; | 303 StringList disabled_categories_; |
269 StringList excluded_categories_; | 304 StringList excluded_categories_; |
270 StringList synthetic_delays_; | 305 StringList synthetic_delays_; |
306 EventFilters event_filters_; | |
271 }; | 307 }; |
272 | 308 |
273 } // namespace trace_event | 309 } // namespace trace_event |
274 } // namespace base | 310 } // namespace base |
275 | 311 |
276 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 312 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |