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

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

Issue 2061923002: Fix default category filter for tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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') | 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 #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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // formatted. 181 // formatted.
182 std::string ToString() const; 182 std::string ToString() const;
183 183
184 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat 184 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat
185 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; 185 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const;
186 186
187 // Write the string representation of the CategoryFilter part. 187 // Write the string representation of the CategoryFilter part.
188 std::string ToCategoryFilterString() const; 188 std::string ToCategoryFilterString() const;
189 189
190 // Returns true if at least one category in the list is enabled by this 190 // Returns true if at least one category in the list is enabled by this
191 // trace config. 191 // trace config. This is used to determine if the category filters are
192 // enabled in the TRACE_* macros.
192 bool IsCategoryGroupEnabled(const char* category_group) const; 193 bool IsCategoryGroupEnabled(const char* category_group) const;
193 194
194 // Merges config with the current TraceConfig 195 // Merges config with the current TraceConfig
195 void Merge(const TraceConfig& config); 196 void Merge(const TraceConfig& config);
196 197
197 void Clear(); 198 void Clear();
198 199
199 // Clears and resets the memory dump config. 200 // Clears and resets the memory dump config.
200 void ResetMemoryDumpConfig(const MemoryDumpConfig& memory_dump_config); 201 void ResetMemoryDumpConfig(const MemoryDumpConfig& memory_dump_config);
201 202
202 const MemoryDumpConfig& memory_dump_config() const { 203 const MemoryDumpConfig& memory_dump_config() const {
203 return memory_dump_config_; 204 return memory_dump_config_;
204 } 205 }
205 206
206 private: 207 private:
207 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat); 208 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidLegacyFormat);
208 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, 209 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
209 TraceConfigFromInvalidLegacyStrings); 210 TraceConfigFromInvalidLegacyStrings);
210 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, ConstructDefaultTraceConfig);
211 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString); 211 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromValidString);
212 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString); 212 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromInvalidString);
213 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, 213 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
214 IsEmptyOrContainsLeadingOrTrailingWhitespace); 214 IsEmptyOrContainsLeadingOrTrailingWhitespace);
215 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString); 215 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, TraceConfigFromMemoryConfigString);
216 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig); 216 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, LegacyStringToMemoryDumpConfig);
217 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest); 217 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest, EmptyMemoryDumpConfigTest);
218 FRIEND_TEST_ALL_PREFIXES(TraceConfigTest,
219 EmptyAndAsteriskCategoryFilterString);
218 220
219 // The default trace config, used when none is provided. 221 // The default trace config, used when none is provided.
220 // Allows all non-disabled-by-default categories through, except if they end 222 // Allows all non-disabled-by-default categories through, except if they end
221 // in the suffix 'Debug' or 'Test'. 223 // in the suffix 'Debug' or 'Test'.
222 void InitializeDefault(); 224 void InitializeDefault();
223 225
224 // Initialize from a config dictionary. 226 // Initialize from a config dictionary.
225 void InitializeFromConfigDict(const DictionaryValue& dict); 227 void InitializeFromConfigDict(const DictionaryValue& dict);
226 228
227 // Initialize from a config string. 229 // Initialize from a config string.
(...skipping 18 matching lines...) Expand all
246 void ToDict(base::DictionaryValue& dict) const; 248 void ToDict(base::DictionaryValue& dict) const;
247 249
248 std::string ToTraceOptionsString() const; 250 std::string ToTraceOptionsString() const;
249 251
250 void WriteCategoryFilterString(const StringList& values, 252 void WriteCategoryFilterString(const StringList& values,
251 std::string* out, 253 std::string* out,
252 bool included) const; 254 bool included) const;
253 void WriteCategoryFilterString(const StringList& delays, 255 void WriteCategoryFilterString(const StringList& delays,
254 std::string* out) const; 256 std::string* out) const;
255 257
256 // Returns true if category is enable according to this trace config. 258 // Returns true if the category is enable according to this trace config.
Primiano Tucci (use gerrit) 2016/06/14 15:13:03 since you are touching this line: s/enable/enabled
Zhen Wang 2016/06/14 20:55:08 Done.
259 // This is only used internally. Please refer to IsCategoryGroupEnabled()
Primiano Tucci (use gerrit) 2016/06/14 15:13:02 Well it's not that this is internal. It's more tha
Zhen Wang 2016/06/14 20:55:08 Updated.
260 // when determining the enabled category filters.
257 bool IsCategoryEnabled(const char* category_name) const; 261 bool IsCategoryEnabled(const char* category_name) const;
258 262
259 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace( 263 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace(
260 const std::string& str); 264 const std::string& str);
261 265
262 bool HasIncludedPatterns() const; 266 bool HasIncludedPatterns() const;
263 267
264 TraceRecordMode record_mode_; 268 TraceRecordMode record_mode_;
265 bool enable_sampling_ : 1; 269 bool enable_sampling_ : 1;
266 bool enable_systrace_ : 1; 270 bool enable_systrace_ : 1;
267 bool enable_argument_filter_ : 1; 271 bool enable_argument_filter_ : 1;
268 272
269 MemoryDumpConfig memory_dump_config_; 273 MemoryDumpConfig memory_dump_config_;
270 274
271 StringList included_categories_; 275 StringList included_categories_;
272 StringList disabled_categories_; 276 StringList disabled_categories_;
273 StringList excluded_categories_; 277 StringList excluded_categories_;
274 StringList synthetic_delays_; 278 StringList synthetic_delays_;
275 }; 279 };
276 280
277 } // namespace trace_event 281 } // namespace trace_event
278 } // namespace base 282 } // namespace base
279 283
280 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ 284 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/trace_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698