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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 enum TraceRecordMode { | 377 enum TraceRecordMode { |
378 // Record until the trace buffer is full. | 378 // Record until the trace buffer is full. |
379 RECORD_UNTIL_FULL, | 379 RECORD_UNTIL_FULL, |
380 | 380 |
381 // Record until the user ends the trace. The trace buffer is a fixed size | 381 // Record until the user ends the trace. The trace buffer is a fixed size |
382 // and we use it as a ring buffer during recording. | 382 // and we use it as a ring buffer during recording. |
383 RECORD_CONTINUOUSLY, | 383 RECORD_CONTINUOUSLY, |
384 | 384 |
385 // Echo to console. Events are discarded. | 385 // Echo to console. Events are discarded. |
386 ECHO_TO_CONSOLE, | 386 ECHO_TO_CONSOLE, |
| 387 |
| 388 // Record until the trace buffer is full, but with a huge buffer size. |
| 389 RECORD_AS_MUCH_AS_POSSIBLE |
387 }; | 390 }; |
388 | 391 |
389 struct BASE_EXPORT TraceOptions { | 392 struct BASE_EXPORT TraceOptions { |
390 | 393 |
391 TraceOptions() | 394 TraceOptions() |
392 : record_mode(RECORD_UNTIL_FULL), | 395 : record_mode(RECORD_UNTIL_FULL), |
393 enable_sampling(false), | 396 enable_sampling(false), |
394 enable_systrace(false) {} | 397 enable_systrace(false) {} |
395 | 398 |
396 TraceOptions(TraceRecordMode record_mode) | 399 TraceOptions(TraceRecordMode record_mode) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, | 645 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
643 TraceBufferRingBufferGetReturnChunk); | 646 TraceBufferRingBufferGetReturnChunk); |
644 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, | 647 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
645 TraceBufferRingBufferHalfIteration); | 648 TraceBufferRingBufferHalfIteration); |
646 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, | 649 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
647 TraceBufferRingBufferFullIteration); | 650 TraceBufferRingBufferFullIteration); |
648 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, | 651 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
649 TraceBufferVectorReportFull); | 652 TraceBufferVectorReportFull); |
650 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, | 653 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
651 ConvertTraceOptionsToInternalOptions); | 654 ConvertTraceOptionsToInternalOptions); |
652 | 655 FRIEND_TEST_ALL_PREFIXES(TraceEventTestFixture, |
| 656 TraceRecordAsMuchAsPossibleMode); |
653 | 657 |
654 // This allows constructor and destructor to be private and usable only | 658 // This allows constructor and destructor to be private and usable only |
655 // by the Singleton class. | 659 // by the Singleton class. |
656 friend struct DefaultSingletonTraits<TraceLog>; | 660 friend struct DefaultSingletonTraits<TraceLog>; |
657 | 661 |
658 // Enable/disable each category group based on the current mode_, | 662 // Enable/disable each category group based on the current mode_, |
659 // category_filter_, event_callback_ and event_callback_category_filter_. | 663 // category_filter_, event_callback_ and event_callback_category_filter_. |
660 // Enable the category group in the enabled mode if category_filter_ matches | 664 // Enable the category group in the enabled mode if category_filter_ matches |
661 // the category group, or event_callback_ is not null and | 665 // the category group, or event_callback_ is not null and |
662 // event_callback_category_filter_ matches the category group. | 666 // event_callback_category_filter_ matches the category group. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 return timestamp - time_offset_; | 726 return timestamp - time_offset_; |
723 } | 727 } |
724 | 728 |
725 // Internal representation of trace options since we store the currently used | 729 // Internal representation of trace options since we store the currently used |
726 // trace option as an AtomicWord. | 730 // trace option as an AtomicWord. |
727 static const InternalTraceOptions kInternalNone; | 731 static const InternalTraceOptions kInternalNone; |
728 static const InternalTraceOptions kInternalRecordUntilFull; | 732 static const InternalTraceOptions kInternalRecordUntilFull; |
729 static const InternalTraceOptions kInternalRecordContinuously; | 733 static const InternalTraceOptions kInternalRecordContinuously; |
730 static const InternalTraceOptions kInternalEchoToConsole; | 734 static const InternalTraceOptions kInternalEchoToConsole; |
731 static const InternalTraceOptions kInternalEnableSampling; | 735 static const InternalTraceOptions kInternalEnableSampling; |
| 736 static const InternalTraceOptions kInternalRecordAsMuchAsPossible; |
732 | 737 |
733 // This lock protects TraceLog member accesses (except for members protected | 738 // This lock protects TraceLog member accesses (except for members protected |
734 // by thread_info_lock_) from arbitrary threads. | 739 // by thread_info_lock_) from arbitrary threads. |
735 mutable Lock lock_; | 740 mutable Lock lock_; |
736 // This lock protects accesses to thread_names_, thread_event_start_times_ | 741 // This lock protects accesses to thread_names_, thread_event_start_times_ |
737 // and thread_colors_. | 742 // and thread_colors_. |
738 Lock thread_info_lock_; | 743 Lock thread_info_lock_; |
739 int locked_line_; | 744 int locked_line_; |
740 Mode mode_; | 745 Mode mode_; |
741 int num_traces_recorded_; | 746 int num_traces_recorded_; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 801 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
797 subtle::AtomicWord generation_; | 802 subtle::AtomicWord generation_; |
798 | 803 |
799 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 804 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
800 }; | 805 }; |
801 | 806 |
802 } // namespace debug | 807 } // namespace debug |
803 } // namespace base | 808 } // namespace base |
804 | 809 |
805 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 810 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |