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 22 matching lines...) Expand all Loading... | |
33 RECORD_AS_MUCH_AS_POSSIBLE, | 33 RECORD_AS_MUCH_AS_POSSIBLE, |
34 | 34 |
35 // Echo to console. Events are discarded. | 35 // Echo to console. Events are discarded. |
36 ECHO_TO_CONSOLE, | 36 ECHO_TO_CONSOLE, |
37 }; | 37 }; |
38 | 38 |
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 triggers in the memory dump config. |
44 // "memory-infra" category is enabled. | |
45 struct MemoryDumpTriggerConfig { | 44 struct MemoryDumpTriggerConfig { |
Primiano Tucci (use gerrit)
2016/04/22 14:18:29
I think just for the sake of legibility these stru
Maria
2016/04/25 18:37:24
Done.
| |
46 uint32_t periodic_interval_ms; | 45 uint32_t periodic_interval_ms; |
47 MemoryDumpLevelOfDetail level_of_detail; | 46 MemoryDumpLevelOfDetail level_of_detail; |
48 }; | 47 }; |
49 | 48 |
50 typedef std::vector<MemoryDumpTriggerConfig> MemoryDumpConfig; | 49 // Specifies the configuration options for the heap profiler. |
50 struct HeapProfilerOptions { | |
51 // Default value for |breakdown_threshold_bytes|. | |
52 enum { kDefaultBreakdownThresholdBytes = 1024 }; | |
53 | |
54 HeapProfilerOptions(); | |
55 ~HeapProfilerOptions(); | |
56 | |
57 // Reset the options to default. | |
58 void Clear(); | |
59 | |
60 uint32_t breakdown_threshold_bytes; | |
61 }; | |
62 | |
63 // Specifies the memory dump config for tracing. | |
64 // Used only when "memory-infra" category is enabled. | |
65 struct MemoryDumpConfig { | |
66 MemoryDumpConfig(); | |
67 MemoryDumpConfig(const MemoryDumpConfig& other); | |
68 ~MemoryDumpConfig(); | |
69 | |
70 // Reset the values in the config. | |
71 void Clear(); | |
72 | |
73 std::vector<MemoryDumpTriggerConfig> triggers; | |
74 HeapProfilerOptions heap_profiler_options; | |
75 }; | |
51 | 76 |
52 TraceConfig(); | 77 TraceConfig(); |
53 | 78 |
54 // Create TraceConfig object from category filter and trace options strings. | 79 // Create TraceConfig object from category filter and trace options strings. |
55 // | 80 // |
56 // |category_filter_string| is a comma-delimited list of category wildcards. | 81 // |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. | 82 // 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 | 83 // All the same rules apply above, so for example, having both included and |
59 // excluded categories in the same list would not be supported. | 84 // excluded categories in the same list would not be supported. |
60 // | 85 // |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 const std::string& trace_options_string); | 230 const std::string& trace_options_string); |
206 | 231 |
207 void SetCategoriesFromIncludedList(const base::ListValue& included_list); | 232 void SetCategoriesFromIncludedList(const base::ListValue& included_list); |
208 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); | 233 void SetCategoriesFromExcludedList(const base::ListValue& excluded_list); |
209 void SetSyntheticDelaysFromList(const base::ListValue& list); | 234 void SetSyntheticDelaysFromList(const base::ListValue& list); |
210 void AddCategoryToDict(base::DictionaryValue& dict, | 235 void AddCategoryToDict(base::DictionaryValue& dict, |
211 const char* param, | 236 const char* param, |
212 const StringList& categories) const; | 237 const StringList& categories) const; |
213 | 238 |
214 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); | 239 void SetMemoryDumpConfig(const base::DictionaryValue& memory_dump_config); |
240 void SetTriggers(const base::DictionaryValue& memory_dump_config); | |
Primiano Tucci (use gerrit)
2016/04/22 14:18:29
why do we have these intermediate setters (SetTrig
Maria
2016/04/25 18:37:24
I found it more clean to do it this way rather tha
| |
241 void SetHeapProfilerOptions(const base::DictionaryValue& memory_dump_config); | |
215 void SetDefaultMemoryDumpConfig(); | 242 void SetDefaultMemoryDumpConfig(); |
216 | 243 |
217 // Convert TraceConfig to the dict representation of the TraceConfig. | 244 // Convert TraceConfig to the dict representation of the TraceConfig. |
218 void ToDict(base::DictionaryValue& dict) const; | 245 void ToDict(base::DictionaryValue& dict) const; |
219 | 246 |
220 std::string ToTraceOptionsString() const; | 247 std::string ToTraceOptionsString() const; |
221 | 248 |
222 void WriteCategoryFilterString(const StringList& values, | 249 void WriteCategoryFilterString(const StringList& values, |
223 std::string* out, | 250 std::string* out, |
224 bool included) const; | 251 bool included) const; |
(...skipping 18 matching lines...) Expand all Loading... | |
243 StringList included_categories_; | 270 StringList included_categories_; |
244 StringList disabled_categories_; | 271 StringList disabled_categories_; |
245 StringList excluded_categories_; | 272 StringList excluded_categories_; |
246 StringList synthetic_delays_; | 273 StringList synthetic_delays_; |
247 }; | 274 }; |
248 | 275 |
249 } // namespace trace_event | 276 } // namespace trace_event |
250 } // namespace base | 277 } // namespace base |
251 | 278 |
252 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 279 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |