OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 char phase_; | 172 char phase_; |
173 unsigned char flags_; | 173 unsigned char flags_; |
174 unsigned char arg_types_[kTraceMaxNumArgs]; | 174 unsigned char arg_types_[kTraceMaxNumArgs]; |
175 | 175 |
176 DISALLOW_COPY_AND_ASSIGN(TraceEvent); | 176 DISALLOW_COPY_AND_ASSIGN(TraceEvent); |
177 }; | 177 }; |
178 | 178 |
179 // TraceBufferChunk is the basic unit of TraceBuffer. | 179 // TraceBufferChunk is the basic unit of TraceBuffer. |
180 class BASE_EXPORT TraceBufferChunk { | 180 class BASE_EXPORT TraceBufferChunk { |
181 public: | 181 public: |
182 TraceBufferChunk(uint32 seq) | 182 explicit TraceBufferChunk(uint32 seq) |
183 : next_free_(0), | 183 : next_free_(0), |
184 seq_(seq) { | 184 seq_(seq) { |
185 } | 185 } |
186 | 186 |
187 void Reset(uint32 new_seq); | 187 void Reset(uint32 new_seq); |
188 TraceEvent* AddTraceEvent(size_t* event_index); | 188 TraceEvent* AddTraceEvent(size_t* event_index); |
189 bool IsFull() const { return next_free_ == kTraceBufferChunkSize; } | 189 bool IsFull() const { return next_free_ == kTraceBufferChunkSize; } |
190 | 190 |
191 uint32 seq() const { return seq_; } | 191 uint32 seq() const { return seq_; } |
192 size_t capacity() const { return kTraceBufferChunkSize; } | 192 size_t capacity() const { return kTraceBufferChunkSize; } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 bool append_comma_; | 274 bool append_comma_; |
275 }; | 275 }; |
276 | 276 |
277 class BASE_EXPORT CategoryFilter { | 277 class BASE_EXPORT CategoryFilter { |
278 public: | 278 public: |
279 typedef std::vector<std::string> StringList; | 279 typedef std::vector<std::string> StringList; |
280 | 280 |
281 // The default category filter, used when none is provided. | 281 // The default category filter, used when none is provided. |
282 // Allows all categories through, except if they end in the suffix 'Debug' or | 282 // Allows all categories through, except if they end in the suffix 'Debug' or |
283 // 'Test'. | 283 // 'Test'. |
284 static const char* kDefaultCategoryFilterString; | 284 static const char kDefaultCategoryFilterString[]; |
285 | 285 |
286 // |filter_string| is a comma-delimited list of category wildcards. | 286 // |filter_string| is a comma-delimited list of category wildcards. |
287 // A category can have an optional '-' prefix to make it an excluded category. | 287 // A category can have an optional '-' prefix to make it an excluded category. |
288 // All the same rules apply above, so for example, having both included and | 288 // All the same rules apply above, so for example, having both included and |
289 // excluded categories in the same list would not be supported. | 289 // excluded categories in the same list would not be supported. |
290 // | 290 // |
291 // Example: CategoryFilter"test_MyTest*"); | 291 // Example: CategoryFilter"test_MyTest*"); |
292 // Example: CategoryFilter("test_MyTest*,test_OtherStuff"); | 292 // Example: CategoryFilter("test_MyTest*,test_OtherStuff"); |
293 // Example: CategoryFilter("-excluded_category1,-excluded_category2"); | 293 // Example: CategoryFilter("-excluded_category1,-excluded_category2"); |
294 // Example: CategoryFilter("-*,webkit"); would disable everything but webkit. | 294 // Example: CategoryFilter("-*,webkit"); would disable everything but webkit. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 RECORD_CONTINUOUSLY, | 373 RECORD_CONTINUOUSLY, |
374 | 374 |
375 // Echo to console. Events are discarded. | 375 // Echo to console. Events are discarded. |
376 ECHO_TO_CONSOLE, | 376 ECHO_TO_CONSOLE, |
377 | 377 |
378 // Record until the trace buffer is full, but with a huge buffer size. | 378 // Record until the trace buffer is full, but with a huge buffer size. |
379 RECORD_AS_MUCH_AS_POSSIBLE | 379 RECORD_AS_MUCH_AS_POSSIBLE |
380 }; | 380 }; |
381 | 381 |
382 struct BASE_EXPORT TraceOptions { | 382 struct BASE_EXPORT TraceOptions { |
383 | |
384 TraceOptions() | 383 TraceOptions() |
385 : record_mode(RECORD_UNTIL_FULL), | 384 : record_mode(RECORD_UNTIL_FULL), |
386 enable_sampling(false), | 385 enable_sampling(false), |
387 enable_systrace(false) {} | 386 enable_systrace(false) {} |
388 | 387 |
389 TraceOptions(TraceRecordMode record_mode) | 388 explicit TraceOptions(TraceRecordMode record_mode) |
390 : record_mode(record_mode), | 389 : record_mode(record_mode), |
391 enable_sampling(false), | 390 enable_sampling(false), |
392 enable_systrace(false) {} | 391 enable_systrace(false) {} |
393 | 392 |
394 // |options_string| is a comma-delimited list of trace options. | 393 // |options_string| is a comma-delimited list of trace options. |
395 // Possible options are: "record-until-full", "record-continuously", | 394 // Possible options are: "record-until-full", "record-continuously", |
396 // "trace-to-console", "enable-sampling" and "enable-systrace". | 395 // "trace-to-console", "enable-sampling" and "enable-systrace". |
397 // The first 3 options are trace recoding modes and hence | 396 // The first 3 options are trace recoding modes and hence |
398 // mutually exclusive. If more than one trace recording modes appear in the | 397 // mutually exclusive. If more than one trace recording modes appear in the |
399 // options_string, the last one takes precedence. If none of the trace | 398 // options_string, the last one takes precedence. If none of the trace |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 800 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
802 subtle::AtomicWord generation_; | 801 subtle::AtomicWord generation_; |
803 | 802 |
804 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 803 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
805 }; | 804 }; |
806 | 805 |
807 } // namespace debug | 806 } // namespace debug |
808 } // namespace base | 807 } // namespace base |
809 | 808 |
810 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 809 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |