| 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_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 7 #define BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 ECHO_TO_CONSOLE, | 380 ECHO_TO_CONSOLE, |
| 381 | 381 |
| 382 // Record until the trace buffer is full, but with a huge buffer size. | 382 // Record until the trace buffer is full, but with a huge buffer size. |
| 383 RECORD_AS_MUCH_AS_POSSIBLE | 383 RECORD_AS_MUCH_AS_POSSIBLE |
| 384 }; | 384 }; |
| 385 | 385 |
| 386 struct BASE_EXPORT TraceOptions { | 386 struct BASE_EXPORT TraceOptions { |
| 387 TraceOptions() | 387 TraceOptions() |
| 388 : record_mode(RECORD_UNTIL_FULL), | 388 : record_mode(RECORD_UNTIL_FULL), |
| 389 enable_sampling(false), | 389 enable_sampling(false), |
| 390 enable_systrace(false) {} | 390 enable_systrace(false), |
| 391 enable_args_whitelist(false) {} |
| 391 | 392 |
| 392 explicit TraceOptions(TraceRecordMode record_mode) | 393 explicit TraceOptions(TraceRecordMode record_mode) |
| 393 : record_mode(record_mode), | 394 : record_mode(record_mode), |
| 394 enable_sampling(false), | 395 enable_sampling(false), |
| 395 enable_systrace(false) {} | 396 enable_systrace(false), |
| 397 enable_args_whitelist(false) {} |
| 396 | 398 |
| 397 // |options_string| is a comma-delimited list of trace options. | 399 // |options_string| is a comma-delimited list of trace options. |
| 398 // Possible options are: "record-until-full", "record-continuously", | 400 // Possible options are: "record-until-full", "record-continuously", |
| 399 // "trace-to-console", "enable-sampling" and "enable-systrace". | 401 // "trace-to-console", "enable-sampling" and "enable-systrace". |
| 400 // The first 3 options are trace recoding modes and hence | 402 // The first 3 options are trace recoding modes and hence |
| 401 // mutually exclusive. If more than one trace recording modes appear in the | 403 // mutually exclusive. If more than one trace recording modes appear in the |
| 402 // options_string, the last one takes precedence. If none of the trace | 404 // options_string, the last one takes precedence. If none of the trace |
| 403 // recording mode is specified, recording mode is RECORD_UNTIL_FULL. | 405 // recording mode is specified, recording mode is RECORD_UNTIL_FULL. |
| 404 // | 406 // |
| 405 // The trace option will first be reset to the default option | 407 // The trace option will first be reset to the default option |
| (...skipping 10 matching lines...) Expand all Loading... |
| 416 // will set ECHO_TO_CONSOLE as the recording mode. | 418 // will set ECHO_TO_CONSOLE as the recording mode. |
| 417 // | 419 // |
| 418 // Returns true on success. | 420 // Returns true on success. |
| 419 bool SetFromString(const std::string& options_string); | 421 bool SetFromString(const std::string& options_string); |
| 420 | 422 |
| 421 std::string ToString() const; | 423 std::string ToString() const; |
| 422 | 424 |
| 423 TraceRecordMode record_mode; | 425 TraceRecordMode record_mode; |
| 424 bool enable_sampling; | 426 bool enable_sampling; |
| 425 bool enable_systrace; | 427 bool enable_systrace; |
| 428 bool enable_args_whitelist; |
| 426 }; | 429 }; |
| 427 | 430 |
| 428 struct BASE_EXPORT TraceLogStatus { | 431 struct BASE_EXPORT TraceLogStatus { |
| 429 TraceLogStatus(); | 432 TraceLogStatus(); |
| 430 ~TraceLogStatus(); | 433 ~TraceLogStatus(); |
| 431 size_t event_capacity; | 434 size_t event_capacity; |
| 432 size_t event_count; | 435 size_t event_count; |
| 433 }; | 436 }; |
| 434 | 437 |
| 435 class BASE_EXPORT TraceLog { | 438 class BASE_EXPORT TraceLog { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 749 } |
| 747 | 750 |
| 748 // Internal representation of trace options since we store the currently used | 751 // Internal representation of trace options since we store the currently used |
| 749 // trace option as an AtomicWord. | 752 // trace option as an AtomicWord. |
| 750 static const InternalTraceOptions kInternalNone; | 753 static const InternalTraceOptions kInternalNone; |
| 751 static const InternalTraceOptions kInternalRecordUntilFull; | 754 static const InternalTraceOptions kInternalRecordUntilFull; |
| 752 static const InternalTraceOptions kInternalRecordContinuously; | 755 static const InternalTraceOptions kInternalRecordContinuously; |
| 753 static const InternalTraceOptions kInternalEchoToConsole; | 756 static const InternalTraceOptions kInternalEchoToConsole; |
| 754 static const InternalTraceOptions kInternalEnableSampling; | 757 static const InternalTraceOptions kInternalEnableSampling; |
| 755 static const InternalTraceOptions kInternalRecordAsMuchAsPossible; | 758 static const InternalTraceOptions kInternalRecordAsMuchAsPossible; |
| 759 static const InternalTraceOptions kInternalEnableArgsWhitelist; |
| 756 | 760 |
| 757 // This lock protects TraceLog member accesses (except for members protected | 761 // This lock protects TraceLog member accesses (except for members protected |
| 758 // by thread_info_lock_) from arbitrary threads. | 762 // by thread_info_lock_) from arbitrary threads. |
| 759 mutable Lock lock_; | 763 mutable Lock lock_; |
| 760 // This lock protects accesses to thread_names_, thread_event_start_times_ | 764 // This lock protects accesses to thread_names_, thread_event_start_times_ |
| 761 // and thread_colors_. | 765 // and thread_colors_. |
| 762 Lock thread_info_lock_; | 766 Lock thread_info_lock_; |
| 763 Mode mode_; | 767 Mode mode_; |
| 764 int num_traces_recorded_; | 768 int num_traces_recorded_; |
| 765 scoped_ptr<TraceBuffer> logged_events_; | 769 scoped_ptr<TraceBuffer> logged_events_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 subtle::AtomicWord generation_; | 825 subtle::AtomicWord generation_; |
| 822 bool use_worker_thread_; | 826 bool use_worker_thread_; |
| 823 | 827 |
| 824 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 828 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 825 }; | 829 }; |
| 826 | 830 |
| 827 } // namespace trace_event | 831 } // namespace trace_event |
| 828 } // namespace base | 832 } // namespace base |
| 829 | 833 |
| 830 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ | 834 #endif // BASE_TRACE_EVENT_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |