| 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 28 matching lines...) Expand all Loading... |
| 39 class BASE_EXPORT TraceConfig { | 39 class BASE_EXPORT TraceConfig { |
| 40 public: | 40 public: |
| 41 typedef std::vector<std::string> StringList; | 41 typedef std::vector<std::string> StringList; |
| 42 | 42 |
| 43 // Specifies the memory dump config for tracing. Used only when | 43 // Specifies the memory dump config for tracing. Used only when |
| 44 // "memory-infra" category is enabled. | 44 // "memory-infra" category is enabled. |
| 45 struct MemoryDumpTriggerConfig { | 45 struct MemoryDumpTriggerConfig { |
| 46 uint32_t periodic_interval_ms; | 46 uint32_t periodic_interval_ms; |
| 47 MemoryDumpLevelOfDetail level_of_detail; | 47 MemoryDumpLevelOfDetail level_of_detail; |
| 48 }; | 48 }; |
| 49 typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; |
| 49 | 50 |
| 50 typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; | 51 struct CategoryEventFilterConfig { |
| 52 CategoryEventFilterConfig(); |
| 53 ~CategoryEventFilterConfig(); |
| 54 |
| 55 CategoryEventFilterConfig(const CategoryEventFilterConfig& tc); |
| 56 CategoryEventFilterConfig& operator=(const CategoryEventFilterConfig& rhs); |
| 57 |
| 58 bool IsCategoryGroupEnabled(const char* category_group_name) const; |
| 59 |
| 60 std::string predicate_name; |
| 61 StringList included_categories; |
| 62 StringList excluded_categories; |
| 63 std::unique_ptr<base::DictionaryValue> args; |
| 64 }; |
| 65 typedef std::vector<CategoryEventFilterConfig> CategoryEventFilters; |
| 51 | 66 |
| 52 TraceConfig(); | 67 TraceConfig(); |
| 53 | 68 |
| 54 // Create TraceConfig object from category filter and trace options strings. | 69 // Create TraceConfig object from category filter and trace options strings. |
| 55 // | 70 // |
| 56 // |category_filter_string| is a comma-delimited list of category wildcards. | 71 // |category_filter_string| is a comma-delimited list of category wildcards. |
| 57 // A category can have an optional '-' prefix to make it an excluded category. | 72 // A category can have an optional '-' prefix to make it an excluded category. |
| 58 // All the same rules apply above, so for example, having both included and | 73 // All the same rules apply above, so for example, having both included and |
| 59 // excluded categories in the same list would not be supported. | 74 // excluded categories in the same list would not be supported. |
| 60 // | 75 // |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 151 |
| 137 TraceConfig(const TraceConfig& tc); | 152 TraceConfig(const TraceConfig& tc); |
| 138 | 153 |
| 139 ~TraceConfig(); | 154 ~TraceConfig(); |
| 140 | 155 |
| 141 TraceConfig& operator=(const TraceConfig& rhs); | 156 TraceConfig& operator=(const TraceConfig& rhs); |
| 142 | 157 |
| 143 // Return a list of the synthetic delays specified in this category filter. | 158 // Return a list of the synthetic delays specified in this category filter. |
| 144 const StringList& GetSyntheticDelayValues() const; | 159 const StringList& GetSyntheticDelayValues() const; |
| 145 | 160 |
| 161 const CategoryEventFilters& GetCategoryEventFilters() const; |
| 162 |
| 146 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } | 163 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } |
| 147 bool IsSamplingEnabled() const { return enable_sampling_; } | 164 bool IsSamplingEnabled() const { return enable_sampling_; } |
| 148 bool IsSystraceEnabled() const { return enable_systrace_; } | 165 bool IsSystraceEnabled() const { return enable_systrace_; } |
| 149 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } | 166 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } |
| 150 | 167 |
| 151 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } | 168 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } |
| 152 void EnableSampling() { enable_sampling_ = true; } | 169 void EnableSampling() { enable_sampling_ = true; } |
| 153 void EnableSystrace() { enable_systrace_ = true; } | 170 void EnableSystrace() { enable_systrace_ = true; } |
| 154 void EnableArgumentFilter() { enable_argument_filter_ = true; } | 171 void EnableArgumentFilter() { enable_argument_filter_ = true; } |
| 155 | 172 |
| 156 // Writes the string representation of the TraceConfig. The string is JSON | 173 // Writes the string representation of the TraceConfig. The string is JSON |
| 157 // formatted. | 174 // formatted. |
| 158 std::string ToString() const; | 175 std::string ToString() const; |
| 159 | 176 |
| 160 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat | 177 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat |
| 161 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; | 178 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; |
| 162 | 179 |
| 163 // Write the string representation of the CategoryFilter part. | 180 // Write the string representation of the CategoryFilter part. |
| 164 std::string ToCategoryFilterString() const; | 181 std::string ToCategoryFilterString() const; |
| 165 | 182 |
| 166 // Returns true if at least one category in the list is enabled by this | 183 // Returns true if at least one category in the list is enabled by this |
| 167 // trace config. | 184 // trace config. |
| 168 bool IsCategoryGroupEnabled(const char* category_group) const; | 185 bool IsCategoryGroupEnabled(const char* category_group_name) const; |
| 169 | 186 |
| 170 // Merges config with the current TraceConfig | 187 // Merges config with the current TraceConfig |
| 171 void Merge(const TraceConfig& config); | 188 void Merge(const TraceConfig& config); |
| 172 | 189 |
| 173 void Clear(); | 190 void Clear(); |
| 174 | 191 |
| 175 const MemoryDumpConfig& memory_dump_config() const { | 192 const MemoryDumpConfig& memory_dump_config() const { |
| 176 return memory_dump_config_; | 193 return memory_dump_config_; |
| 177 } | 194 } |
| 178 | 195 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 207 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 224 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
| 208 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 225 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
| 209 void SetSyntheticDelaysFromList(const base::ListValue& list); | 226 void SetSyntheticDelaysFromList(const base::ListValue& list); |
| 210 void AddCategoryToDict(base::DictionaryValue& dict, | 227 void AddCategoryToDict(base::DictionaryValue& dict, |
| 211 const char* param, | 228 const char* param, |
| 212 const StringList& categories) const; | 229 const StringList& categories) const; |
| 213 | 230 |
| 214 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); | 231 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); |
| 215 void SetDefaultMemoryDumpConfig(); | 232 void SetDefaultMemoryDumpConfig(); |
| 216 | 233 |
| 234 void SetCategoryEventFilters(const base::ListValue& category_event_filters); |
| 235 |
| 217 // Convert TraceConfig to the dict representation of the TraceConfig. | 236 // Convert TraceConfig to the dict representation of the TraceConfig. |
| 218 void ToDict(base::DictionaryValue& dict) const; | 237 void ToDict(base::DictionaryValue& dict) const; |
| 219 | 238 |
| 220 std::string ToTraceOptionsString() const; | 239 std::string ToTraceOptionsString() const; |
| 221 | 240 |
| 222 void WriteCategoryFilterString(const StringList& values, | 241 void WriteCategoryFilterString(const StringList& values, |
| 223 std::string* out, | 242 std::string* out, |
| 224 bool included) const; | 243 bool included) const; |
| 225 void WriteCategoryFilterString(const StringList& delays, | 244 void WriteCategoryFilterString(const StringList& delays, |
| 226 std::string* out) const; | 245 std::string* out) const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 237 bool enable_sampling_ : 1; | 256 bool enable_sampling_ : 1; |
| 238 bool enable_systrace_ : 1; | 257 bool enable_systrace_ : 1; |
| 239 bool enable_argument_filter_ : 1; | 258 bool enable_argument_filter_ : 1; |
| 240 | 259 |
| 241 MemoryDumpConfig memory_dump_config_; | 260 MemoryDumpConfig memory_dump_config_; |
| 242 | 261 |
| 243 StringList included_categories_; | 262 StringList included_categories_; |
| 244 StringList disabled_categories_; | 263 StringList disabled_categories_; |
| 245 StringList excluded_categories_; | 264 StringList excluded_categories_; |
| 246 StringList synthetic_delays_; | 265 StringList synthetic_delays_; |
| 266 CategoryEventFilters category_event_filters_; |
| 247 }; | 267 }; |
| 248 | 268 |
| 249 } // namespace trace_event | 269 } // namespace trace_event |
| 250 } // namespace base | 270 } // namespace base |
| 251 | 271 |
| 252 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 272 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
| OLD | NEW |