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