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

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

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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/stack_trace.h ('k') | base/debug/trace_event_win.h » ('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) 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair. 295 // Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
296 enum TraceEventPhase { 296 enum TraceEventPhase {
297 TRACE_EVENT_PHASE_BEGIN, 297 TRACE_EVENT_PHASE_BEGIN,
298 TRACE_EVENT_PHASE_END, 298 TRACE_EVENT_PHASE_END,
299 TRACE_EVENT_PHASE_INSTANT 299 TRACE_EVENT_PHASE_INSTANT
300 }; 300 };
301 301
302 // Simple union of values. This is much lighter weight than base::Value, which 302 // Simple union of values. This is much lighter weight than base::Value, which
303 // requires dynamic allocation and a vtable. To keep the trace runtime overhead 303 // requires dynamic allocation and a vtable. To keep the trace runtime overhead
304 // low, we want constant size storage here. 304 // low, we want constant size storage here.
305 class BASE_API TraceValue { 305 class BASE_EXPORT TraceValue {
306 public: 306 public:
307 enum Type { 307 enum Type {
308 TRACE_TYPE_UNDEFINED, 308 TRACE_TYPE_UNDEFINED,
309 TRACE_TYPE_BOOL, 309 TRACE_TYPE_BOOL,
310 TRACE_TYPE_UINT, 310 TRACE_TYPE_UINT,
311 TRACE_TYPE_INT, 311 TRACE_TYPE_INT,
312 TRACE_TYPE_DOUBLE, 312 TRACE_TYPE_DOUBLE,
313 TRACE_TYPE_POINTER, 313 TRACE_TYPE_POINTER,
314 TRACE_TYPE_STRING 314 TRACE_TYPE_STRING
315 }; 315 };
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 TimeTicks timestamp_; 435 TimeTicks timestamp_;
436 TraceEventPhase phase_; 436 TraceEventPhase phase_;
437 const TraceCategory* category_; 437 const TraceCategory* category_;
438 const char* name_; 438 const char* name_;
439 const char* arg_names_[kTraceMaxNumArgs]; 439 const char* arg_names_[kTraceMaxNumArgs];
440 TraceValue arg_values_[kTraceMaxNumArgs]; 440 TraceValue arg_values_[kTraceMaxNumArgs];
441 scoped_refptr<base::RefCountedString> parameter_copy_storage_; 441 scoped_refptr<base::RefCountedString> parameter_copy_storage_;
442 }; 442 };
443 443
444 444
445 class BASE_API TraceLog { 445 class BASE_EXPORT TraceLog {
446 public: 446 public:
447 static TraceLog* GetInstance(); 447 static TraceLog* GetInstance();
448 448
449 // Global enable of tracing. Currently enables all categories or not. 449 // Global enable of tracing. Currently enables all categories or not.
450 // TODO(scheib): Replace with an Enable/DisableCategory() that 450 // TODO(scheib): Replace with an Enable/DisableCategory() that
451 // implicitly controls the global logging state. 451 // implicitly controls the global logging state.
452 void SetEnabled(bool enabled); 452 void SetEnabled(bool enabled);
453 bool IsEnabled() { return enabled_; } 453 bool IsEnabled() { return enabled_; }
454 454
455 float GetBufferPercentFull() const; 455 float GetBufferPercentFull() const;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 OutputCallback output_callback_; 520 OutputCallback output_callback_;
521 BufferFullCallback buffer_full_callback_; 521 BufferFullCallback buffer_full_callback_;
522 std::vector<TraceEvent> logged_events_; 522 std::vector<TraceEvent> logged_events_;
523 523
524 DISALLOW_COPY_AND_ASSIGN(TraceLog); 524 DISALLOW_COPY_AND_ASSIGN(TraceLog);
525 }; 525 };
526 526
527 namespace internal { 527 namespace internal {
528 528
529 // Used by TRACE_EVENTx macro. Do not use directly. 529 // Used by TRACE_EVENTx macro. Do not use directly.
530 class BASE_API TraceEndOnScopeClose { 530 class BASE_EXPORT TraceEndOnScopeClose {
531 public: 531 public:
532 TraceEndOnScopeClose() : p_data_(NULL) {} 532 TraceEndOnScopeClose() : p_data_(NULL) {}
533 ~TraceEndOnScopeClose() { 533 ~TraceEndOnScopeClose() {
534 if (p_data_) 534 if (p_data_)
535 AddEventIfEnabled(); 535 AddEventIfEnabled();
536 } 536 }
537 537
538 void Initialize(const TraceCategory* category, 538 void Initialize(const TraceCategory* category,
539 const char* name); 539 const char* name);
540 540
541 private: 541 private:
542 // Add the end event if the category is still enabled. 542 // Add the end event if the category is still enabled.
543 void AddEventIfEnabled(); 543 void AddEventIfEnabled();
544 544
545 // This Data struct workaround is to avoid initializing all the members 545 // This Data struct workaround is to avoid initializing all the members
546 // in Data during construction of this object, since this object is always 546 // in Data during construction of this object, since this object is always
547 // constructed, even when tracing is disabled. If the members of Data were 547 // constructed, even when tracing is disabled. If the members of Data were
548 // members of this class instead, compiler warnings occur about potential 548 // members of this class instead, compiler warnings occur about potential
549 // uninitialized accesses. 549 // uninitialized accesses.
550 struct Data { 550 struct Data {
551 const TraceCategory* category; 551 const TraceCategory* category;
552 const char* name; 552 const char* name;
553 }; 553 };
554 Data* p_data_; 554 Data* p_data_;
555 Data data_; 555 Data data_;
556 }; 556 };
557 557
558 // Used by TRACE_EVENTx macro. Do not use directly. 558 // Used by TRACE_EVENTx macro. Do not use directly.
559 class BASE_API TraceEndOnScopeCloseThreshold { 559 class BASE_EXPORT TraceEndOnScopeCloseThreshold {
560 public: 560 public:
561 TraceEndOnScopeCloseThreshold() : p_data_(NULL) {} 561 TraceEndOnScopeCloseThreshold() : p_data_(NULL) {}
562 ~TraceEndOnScopeCloseThreshold() { 562 ~TraceEndOnScopeCloseThreshold() {
563 if (p_data_) 563 if (p_data_)
564 AddEventIfEnabled(); 564 AddEventIfEnabled();
565 } 565 }
566 566
567 // Called by macros only when tracing is enabled at the point when the begin 567 // Called by macros only when tracing is enabled at the point when the begin
568 // event is added. 568 // event is added.
569 void Initialize(const TraceCategory* category, 569 void Initialize(const TraceCategory* category,
(...skipping 19 matching lines...) Expand all
589 Data* p_data_; 589 Data* p_data_;
590 Data data_; 590 Data data_;
591 }; 591 };
592 592
593 } // namespace internal 593 } // namespace internal
594 594
595 } // namespace debug 595 } // namespace debug
596 } // namespace base 596 } // namespace base
597 597
598 #endif // BASE_DEBUG_TRACE_EVENT_H_ 598 #endif // BASE_DEBUG_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « base/debug/stack_trace.h ('k') | base/debug/trace_event_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698