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

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

Issue 7778033: Add trace code to track all posted tasks in message_loop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed file/line merge from Location Created 9 years, 2 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 | « no previous file | base/debug/trace_event.cc » ('j') | base/debug/trace_event_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Trace events are for tracking application performance. 5 // Trace events are for tracking application performance.
6 // 6 //
7 // Events are issued against categories. Whereas LOG's 7 // Events are issued against categories. Whereas LOG's
8 // categories are statically defined, TRACE categories are created 8 // categories are statically defined, TRACE categories are created
9 // implicitly with a string. For example: 9 // implicitly with a string. For example:
10 // TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent") 10 // TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent")
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // - category and name strings must have application lifetime (statics or 134 // - category and name strings must have application lifetime (statics or
135 // literals). They may not include " chars. 135 // literals). They may not include " chars.
136 #define TRACE_EVENT0(category, name) \ 136 #define TRACE_EVENT0(category, name) \
137 TRACE_EVENT1(category, name, NULL, 0) 137 TRACE_EVENT1(category, name, NULL, 0)
138 #define TRACE_EVENT1(category, name, arg1_name, arg1_val) \ 138 #define TRACE_EVENT1(category, name, arg1_name, arg1_val) \
139 TRACE_EVENT2(category, name, arg1_name, arg1_val, NULL, 0) 139 TRACE_EVENT2(category, name, arg1_name, arg1_val, NULL, 0)
140 #define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \ 140 #define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \
141 INTERNAL_TRACE_EVENT_ADD_SCOPED( \ 141 INTERNAL_TRACE_EVENT_ADD_SCOPED( \
142 category, name, arg1_name, arg1_val, arg2_name, arg2_val) 142 category, name, arg1_name, arg1_val, arg2_name, arg2_val)
143 143
144 // Same as TRACE_EVENT except that they are not included in official builds.
145 #ifdef OFFICIAL_BUILD
146 #define UNSHIPPED_TRACE_EVENT0(category, name) (void)0
147 #define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) (void)0
148 #define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \
149 arg2_name, arg2_val) (void)0
150 #else
151 #define UNSHIPPED_TRACE_EVENT0(category, name) \
152 TRACE_EVENT0(category, name)
153 #define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) \
154 TRACE_EVENT1(category, name, arg1_name, arg1_val)
155 #define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \
156 arg2_name, arg2_val) \
157 TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val)
158 #endif
159
144 // Records a single event called "name" immediately, with 0, 1 or 2 160 // Records a single event called "name" immediately, with 0, 1 or 2
145 // associated arguments. If the category is not enabled, then this 161 // associated arguments. If the category is not enabled, then this
146 // does nothing. 162 // does nothing.
147 // - category and name strings must have application lifetime (statics or 163 // - category and name strings must have application lifetime (statics or
148 // literals). They may not include " chars. 164 // literals). They may not include " chars.
149 #define TRACE_EVENT_INSTANT0(category, name) \ 165 #define TRACE_EVENT_INSTANT0(category, name) \
150 TRACE_EVENT_INSTANT1(category, name, NULL, 0) 166 TRACE_EVENT_INSTANT1(category, name, NULL, 0)
151 #define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ 167 #define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
152 TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, NULL, 0) 168 TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, NULL, 0)
153 #define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \ 169 #define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 const char* name, 586 const char* name,
571 const void* id, 587 const void* id,
572 const char* extra); 588 const char* extra);
573 static void AddTraceEventEtw(TraceEventPhase phase, 589 static void AddTraceEventEtw(TraceEventPhase phase,
574 const char* name, 590 const char* name,
575 const void* id, 591 const void* id,
576 const std::string& extra); 592 const std::string& extra);
577 593
578 // Exposed for unittesting: 594 // Exposed for unittesting:
579 595
596 // Allows deleting our singleton instance.
597 static void DeleteForTesting();
598
580 // Allows resurrecting our singleton instance post-AtExit processing. 599 // Allows resurrecting our singleton instance post-AtExit processing.
581 static void Resurrect(); 600 static void Resurrect();
582 601
583 // Allow tests to inspect TraceEvents. 602 // Allow tests to inspect TraceEvents.
584 size_t GetEventsSize() const { return logged_events_.size(); } 603 size_t GetEventsSize() const { return logged_events_.size(); }
585 const TraceEvent& GetEventAt(size_t index) const { 604 const TraceEvent& GetEventAt(size_t index) const {
586 DCHECK(index < logged_events_.size()); 605 DCHECK(index < logged_events_.size());
587 return logged_events_[index]; 606 return logged_events_[index];
588 } 607 }
589 608
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 Data* p_data_; 698 Data* p_data_;
680 Data data_; 699 Data data_;
681 }; 700 };
682 701
683 } // namespace internal 702 } // namespace internal
684 703
685 } // namespace debug 704 } // namespace debug
686 } // namespace base 705 } // namespace base
687 706
688 #endif // BASE_DEBUG_TRACE_EVENT_H_ 707 #endif // BASE_DEBUG_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event.cc » ('j') | base/debug/trace_event_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698