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 <set> | 10 #include <set> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // | 118 // |
119 // |category_filter_string| is a comma-delimited list of category wildcards. | 119 // |category_filter_string| is a comma-delimited list of category wildcards. |
120 // A category can have an optional '-' prefix to make it an excluded category. | 120 // A category can have an optional '-' prefix to make it an excluded category. |
121 // All the same rules apply above, so for example, having both included and | 121 // All the same rules apply above, so for example, having both included and |
122 // excluded categories in the same list would not be supported. | 122 // excluded categories in the same list would not be supported. |
123 // | 123 // |
124 // Category filters can also be used to configure synthetic delays. | 124 // Category filters can also be used to configure synthetic delays. |
125 // | 125 // |
126 // |trace_options_string| is a comma-delimited list of trace options. | 126 // |trace_options_string| is a comma-delimited list of trace options. |
127 // Possible options are: "record-until-full", "record-continuously", | 127 // Possible options are: "record-until-full", "record-continuously", |
128 // "record-as-much-as-possible", "trace-to-console", "enable-sampling", | 128 // "record-as-much-as-possible", "trace-to-console", "enable-systrace" and |
129 // "enable-systrace" and "enable-argument-filter". | 129 // "enable-argument-filter". |
130 // The first 4 options are trace recoding modes and hence | 130 // The first 4 options are trace recoding modes and hence |
131 // mutually exclusive. If more than one trace recording modes appear in the | 131 // mutually exclusive. If more than one trace recording modes appear in the |
132 // options_string, the last one takes precedence. If none of the trace | 132 // options_string, the last one takes precedence. If none of the trace |
133 // recording mode is specified, recording mode is RECORD_UNTIL_FULL. | 133 // recording mode is specified, recording mode is RECORD_UNTIL_FULL. |
134 // | 134 // |
135 // The trace option will first be reset to the default option | 135 // The trace option will first be reset to the default option |
136 // (record_mode set to RECORD_UNTIL_FULL, enable_sampling, enable_systrace, | 136 // (record_mode set to RECORD_UNTIL_FULL, enable_systrace and |
137 // and enable_argument_filter set to false) before options parsed from | 137 // enable_argument_filter set to false) before options parsed from |
138 // |trace_options_string| are applied on it. If |trace_options_string| is | 138 // |trace_options_string| are applied on it. If |trace_options_string| is |
139 // invalid, the final state of trace options is undefined. | 139 // invalid, the final state of trace options is undefined. |
140 // | 140 // |
141 // Example: TraceConfig("test_MyTest*", "record-until-full"); | 141 // Example: TraceConfig("test_MyTest*", "record-until-full"); |
142 // Example: TraceConfig("test_MyTest*,test_OtherStuff", | 142 // Example: TraceConfig("test_MyTest*,test_OtherStuff", |
143 // "record-continuously, enable-sampling"); | 143 // "record-continuously"); |
144 // Example: TraceConfig("-excluded_category1,-excluded_category2", | 144 // Example: TraceConfig("-excluded_category1,-excluded_category2", |
145 // "record-until-full, trace-to-console"); | 145 // "record-until-full, trace-to-console"); |
146 // would set ECHO_TO_CONSOLE as the recording mode. | 146 // would set ECHO_TO_CONSOLE as the recording mode. |
147 // Example: TraceConfig("-*,webkit", ""); | 147 // Example: TraceConfig("-*,webkit", ""); |
148 // would disable everything but webkit; and use default options. | 148 // would disable everything but webkit; and use default options. |
149 // Example: TraceConfig("-webkit", ""); | 149 // Example: TraceConfig("-webkit", ""); |
150 // would enable everything but webkit; and use default options. | 150 // would enable everything but webkit; and use default options. |
151 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16)", ""); | 151 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16)", ""); |
152 // would make swap buffers always take at least 16 ms; and use | 152 // would make swap buffers always take at least 16 ms; and use |
153 // default options. | 153 // default options. |
154 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16;oneshot)", ""); | 154 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16;oneshot)", ""); |
155 // would make swap buffers take at least 16 ms the first time it is | 155 // would make swap buffers take at least 16 ms the first time it is |
156 // called; and use default options. | 156 // called; and use default options. |
157 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16;alternating)", ""); | 157 // Example: TraceConfig("DELAY(gpu.PresentingFrame;16;alternating)", ""); |
158 // would make swap buffers take at least 16 ms every other time it | 158 // would make swap buffers take at least 16 ms every other time it |
159 // is called; and use default options. | 159 // is called; and use default options. |
160 TraceConfig(StringPiece category_filter_string, | 160 TraceConfig(StringPiece category_filter_string, |
161 StringPiece trace_options_string); | 161 StringPiece trace_options_string); |
162 | 162 |
163 TraceConfig(StringPiece category_filter_string, TraceRecordMode record_mode); | 163 TraceConfig(StringPiece category_filter_string, TraceRecordMode record_mode); |
164 | 164 |
165 // Create TraceConfig object from the trace config string. | 165 // Create TraceConfig object from the trace config string. |
166 // | 166 // |
167 // |config_string| is a dictionary formatted as a JSON string, containing both | 167 // |config_string| is a dictionary formatted as a JSON string, containing both |
168 // category filters and trace options. | 168 // category filters and trace options. |
169 // | 169 // |
170 // Example: | 170 // Example: |
171 // { | 171 // { |
172 // "record_mode": "record-continuously", | 172 // "record_mode": "record-continuously", |
173 // "enable_sampling": true, | |
174 // "enable_systrace": true, | 173 // "enable_systrace": true, |
175 // "enable_argument_filter": true, | 174 // "enable_argument_filter": true, |
176 // "included_categories": ["included", | 175 // "included_categories": ["included", |
177 // "inc_pattern*", | 176 // "inc_pattern*", |
178 // "disabled-by-default-memory-infra"], | 177 // "disabled-by-default-memory-infra"], |
179 // "excluded_categories": ["excluded", "exc_pattern*"], | 178 // "excluded_categories": ["excluded", "exc_pattern*"], |
180 // "synthetic_delays": ["test.Delay1;16", "test.Delay2;32"], | 179 // "synthetic_delays": ["test.Delay1;16", "test.Delay2;32"], |
181 // "memory_dump_config": { | 180 // "memory_dump_config": { |
182 // "triggers": [ | 181 // "triggers": [ |
183 // { | 182 // { |
(...skipping 15 matching lines...) Expand all Loading... |
199 TraceConfig(const TraceConfig& tc); | 198 TraceConfig(const TraceConfig& tc); |
200 | 199 |
201 ~TraceConfig(); | 200 ~TraceConfig(); |
202 | 201 |
203 TraceConfig& operator=(const TraceConfig& rhs); | 202 TraceConfig& operator=(const TraceConfig& rhs); |
204 | 203 |
205 // Return a list of the synthetic delays specified in this category filter. | 204 // Return a list of the synthetic delays specified in this category filter. |
206 const StringList& GetSyntheticDelayValues() const; | 205 const StringList& GetSyntheticDelayValues() const; |
207 | 206 |
208 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } | 207 TraceRecordMode GetTraceRecordMode() const { return record_mode_; } |
209 bool IsSamplingEnabled() const { return enable_sampling_; } | |
210 bool IsSystraceEnabled() const { return enable_systrace_; } | 208 bool IsSystraceEnabled() const { return enable_systrace_; } |
211 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } | 209 bool IsArgumentFilterEnabled() const { return enable_argument_filter_; } |
212 | 210 |
213 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } | 211 void SetTraceRecordMode(TraceRecordMode mode) { record_mode_ = mode; } |
214 void EnableSampling() { enable_sampling_ = true; } | |
215 void EnableSystrace() { enable_systrace_ = true; } | 212 void EnableSystrace() { enable_systrace_ = true; } |
216 void EnableArgumentFilter() { enable_argument_filter_ = true; } | 213 void EnableArgumentFilter() { enable_argument_filter_ = true; } |
217 | 214 |
218 // Writes the string representation of the TraceConfig. The string is JSON | 215 // Writes the string representation of the TraceConfig. The string is JSON |
219 // formatted. | 216 // formatted. |
220 std::string ToString() const; | 217 std::string ToString() const; |
221 | 218 |
222 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat | 219 // Returns a copy of the TraceConfig wrapped in a ConvertableToTraceFormat |
223 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; | 220 std::unique_ptr<ConvertableToTraceFormat> AsConvertableToTraceFormat() const; |
224 | 221 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // This tells whether a category is enabled from the TraceConfig's | 296 // This tells whether a category is enabled from the TraceConfig's |
300 // perspective. Please refer to IsCategoryGroupEnabled() to determine if a | 297 // perspective. Please refer to IsCategoryGroupEnabled() to determine if a |
301 // category is enabled from the tracing runtime's perspective. | 298 // category is enabled from the tracing runtime's perspective. |
302 bool IsCategoryEnabled(const char* category_name) const; | 299 bool IsCategoryEnabled(const char* category_name) const; |
303 | 300 |
304 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace(StringPiece str); | 301 static bool IsEmptyOrContainsLeadingOrTrailingWhitespace(StringPiece str); |
305 | 302 |
306 bool HasIncludedPatterns() const; | 303 bool HasIncludedPatterns() const; |
307 | 304 |
308 TraceRecordMode record_mode_; | 305 TraceRecordMode record_mode_; |
309 bool enable_sampling_ : 1; | |
310 bool enable_systrace_ : 1; | 306 bool enable_systrace_ : 1; |
311 bool enable_argument_filter_ : 1; | 307 bool enable_argument_filter_ : 1; |
312 | 308 |
313 MemoryDumpConfig memory_dump_config_; | 309 MemoryDumpConfig memory_dump_config_; |
314 | 310 |
315 StringList included_categories_; | 311 StringList included_categories_; |
316 StringList disabled_categories_; | 312 StringList disabled_categories_; |
317 StringList excluded_categories_; | 313 StringList excluded_categories_; |
318 StringList synthetic_delays_; | 314 StringList synthetic_delays_; |
319 EventFilters event_filters_; | 315 EventFilters event_filters_; |
320 }; | 316 }; |
321 | 317 |
322 } // namespace trace_event | 318 } // namespace trace_event |
323 } // namespace base | 319 } // namespace base |
324 | 320 |
325 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ | 321 #endif // BASE_TRACE_EVENT_TRACE_CONFIG_H_ |
OLD | NEW |