| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 Options trace_options() const { return trace_options_; } | 310 Options trace_options() const { return trace_options_; } |
| 311 | 311 |
| 312 // Enables tracing. See CategoryFilter comments for details | 312 // Enables tracing. See CategoryFilter comments for details |
| 313 // on how to control what categories will be traced. | 313 // on how to control what categories will be traced. |
| 314 void SetEnabled(const CategoryFilter& category_filter, Options options); | 314 void SetEnabled(const CategoryFilter& category_filter, Options options); |
| 315 | 315 |
| 316 // Disable tracing for all categories. | 316 // Disable tracing for all categories. |
| 317 void SetDisabled(); | 317 void SetDisabled(); |
| 318 bool IsEnabled() { return !!enable_count_; } | 318 bool IsEnabled() { return !!enable_count_; } |
| 319 | 319 |
| 320 // The number of times we have begun recording traces. If tracing is off, |
| 321 // returns -1. If tracing is on, then it returns the number of times we have |
| 322 // recorded a trace. By watching for this number to increment, you can |
| 323 // passively discover when a new trace has begun. This is then used to |
| 324 // implement the TRACE_EVENT_IS_NEW_TRACE() primitive. |
| 325 int GetNumTracesRecorded(); |
| 326 |
| 320 #if defined(OS_ANDROID) | 327 #if defined(OS_ANDROID) |
| 321 void StartATrace(); | 328 void StartATrace(); |
| 322 void StopATrace(); | 329 void StopATrace(); |
| 323 #endif | 330 #endif |
| 324 | 331 |
| 325 // Enabled state listeners give a callback when tracing is enabled or | 332 // Enabled state listeners give a callback when tracing is enabled or |
| 326 // disabled. This can be used to tie into other library's tracing systems | 333 // disabled. This can be used to tie into other library's tracing systems |
| 327 // on-demand. | 334 // on-demand. |
| 328 class EnabledStateChangedObserver { | 335 class EnabledStateChangedObserver { |
| 329 public: | 336 public: |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 static void ApplyATraceEnabledFlag(unsigned char* category_group_enabled); | 526 static void ApplyATraceEnabledFlag(unsigned char* category_group_enabled); |
| 520 #endif | 527 #endif |
| 521 | 528 |
| 522 TraceBuffer* GetTraceBuffer(); | 529 TraceBuffer* GetTraceBuffer(); |
| 523 | 530 |
| 524 // TODO(nduca): switch to per-thread trace buffers to reduce thread | 531 // TODO(nduca): switch to per-thread trace buffers to reduce thread |
| 525 // synchronization. | 532 // synchronization. |
| 526 // This lock protects TraceLog member accesses from arbitrary threads. | 533 // This lock protects TraceLog member accesses from arbitrary threads. |
| 527 Lock lock_; | 534 Lock lock_; |
| 528 int enable_count_; | 535 int enable_count_; |
| 536 int num_traces_recorded_; |
| 529 NotificationCallback notification_callback_; | 537 NotificationCallback notification_callback_; |
| 530 scoped_ptr<TraceBuffer> logged_events_; | 538 scoped_ptr<TraceBuffer> logged_events_; |
| 531 EventCallback event_callback_; | 539 EventCallback event_callback_; |
| 532 bool dispatching_to_observer_list_; | 540 bool dispatching_to_observer_list_; |
| 533 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; | 541 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; |
| 534 | 542 |
| 535 base::hash_map<int, std::string> thread_names_; | 543 base::hash_map<int, std::string> thread_names_; |
| 536 base::hash_map<int, std::stack<TimeTicks> > thread_event_start_times_; | 544 base::hash_map<int, std::stack<TimeTicks> > thread_event_start_times_; |
| 537 base::hash_map<std::string, int> thread_colors_; | 545 base::hash_map<std::string, int> thread_colors_; |
| 538 | 546 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 555 | 563 |
| 556 CategoryFilter category_filter_; | 564 CategoryFilter category_filter_; |
| 557 | 565 |
| 558 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 566 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
| 559 }; | 567 }; |
| 560 | 568 |
| 561 } // namespace debug | 569 } // namespace debug |
| 562 } // namespace base | 570 } // namespace base |
| 563 | 571 |
| 564 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 572 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
| OLD | NEW |