Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: base/debug/trace_event_impl.h

Issue 15774010: Add TRACE_EVENT_IS_NEW_TRACE as a way to snapshot objects at start of recording (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: parts for enne Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 static void ApplyATraceEnabledFlag(unsigned char* category_group_enabled); 524 static void ApplyATraceEnabledFlag(unsigned char* category_group_enabled);
518 #endif 525 #endif
519 526
520 TraceBuffer* GetTraceBuffer(); 527 TraceBuffer* GetTraceBuffer();
521 528
522 // TODO(nduca): switch to per-thread trace buffers to reduce thread 529 // TODO(nduca): switch to per-thread trace buffers to reduce thread
523 // synchronization. 530 // synchronization.
524 // This lock protects TraceLog member accesses from arbitrary threads. 531 // This lock protects TraceLog member accesses from arbitrary threads.
525 Lock lock_; 532 Lock lock_;
526 int enable_count_; 533 int enable_count_;
534 int num_traces_recorded_;
527 NotificationCallback notification_callback_; 535 NotificationCallback notification_callback_;
528 scoped_ptr<TraceBuffer> logged_events_; 536 scoped_ptr<TraceBuffer> logged_events_;
529 EventCallback event_callback_; 537 EventCallback event_callback_;
530 bool dispatching_to_observer_list_; 538 bool dispatching_to_observer_list_;
531 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; 539 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_;
532 540
533 base::hash_map<int, std::string> thread_names_; 541 base::hash_map<int, std::string> thread_names_;
534 base::hash_map<int, std::stack<TimeTicks> > thread_event_start_times_; 542 base::hash_map<int, std::stack<TimeTicks> > thread_event_start_times_;
535 base::hash_map<std::string, int> thread_colors_; 543 base::hash_map<std::string, int> thread_colors_;
536 544
(...skipping 16 matching lines...) Expand all
553 561
554 CategoryFilter category_filter_; 562 CategoryFilter category_filter_;
555 563
556 DISALLOW_COPY_AND_ASSIGN(TraceLog); 564 DISALLOW_COPY_AND_ASSIGN(TraceLog);
557 }; 565 };
558 566
559 } // namespace debug 567 } // namespace debug
560 } // namespace base 568 } // namespace base
561 569
562 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 570 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698