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

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: rebase 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
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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_
OLDNEW
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698