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 // This header file defines the set of trace_event macros without specifying | 5 // This header file defines the set of trace_event macros without specifying |
6 // how the events actually get collected and stored. If you need to expose trace | 6 // how the events actually get collected and stored. If you need to expose trace |
7 // events to some other universe, you can copy-and-paste this file as well as | 7 // events to some other universe, you can copy-and-paste this file as well as |
8 // trace_event.h, modifying the macros contained there as necessary for the | 8 // trace_event.h, modifying the macros contained there as necessary for the |
9 // target platform. The end result is that multiple libraries can funnel events | 9 // target platform. The end result is that multiple libraries can funnel events |
10 // through to a shared trace event collector. | 10 // through to a shared trace event collector. |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 781 |
782 // Defines atomic operations used internally by the tracing system. | 782 // Defines atomic operations used internally by the tracing system. |
783 #define TRACE_EVENT_API_ATOMIC_WORD base::subtle::AtomicWord | 783 #define TRACE_EVENT_API_ATOMIC_WORD base::subtle::AtomicWord |
784 #define TRACE_EVENT_API_ATOMIC_LOAD(var) base::subtle::NoBarrier_Load(&(var)) | 784 #define TRACE_EVENT_API_ATOMIC_LOAD(var) base::subtle::NoBarrier_Load(&(var)) |
785 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \ | 785 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \ |
786 base::subtle::NoBarrier_Store(&(var), (value)) | 786 base::subtle::NoBarrier_Store(&(var), (value)) |
787 | 787 |
788 // Defines visibility for classes in trace_event.h | 788 // Defines visibility for classes in trace_event.h |
789 #define TRACE_EVENT_API_CLASS_EXPORT BASE_EXPORT | 789 #define TRACE_EVENT_API_CLASS_EXPORT BASE_EXPORT |
790 | 790 |
| 791 // Not supported in split-dll build. http://crbug.com/256965 |
| 792 #if !defined(CHROME_SPLIT_DLL) |
791 // The thread buckets for the sampling profiler. | 793 // The thread buckets for the sampling profiler. |
792 TRACE_EVENT_API_CLASS_EXPORT extern \ | 794 TRACE_EVENT_API_CLASS_EXPORT extern \ |
793 TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; | 795 TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; |
794 | 796 |
795 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ | 797 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ |
796 g_trace_state[thread_bucket] | 798 g_trace_state[thread_bucket] |
797 | 799 |
| 800 #endif |
| 801 |
798 //////////////////////////////////////////////////////////////////////////////// | 802 //////////////////////////////////////////////////////////////////////////////// |
799 | 803 |
800 // Implementation detail: trace event macros create temporary variables | 804 // Implementation detail: trace event macros create temporary variables |
801 // to keep instrumentation overhead low. These macros give each temporary | 805 // to keep instrumentation overhead low. These macros give each temporary |
802 // variable a unique name based on the line number to prevent name collissions. | 806 // variable a unique name based on the line number to prevent name collissions. |
803 #define INTERNAL_TRACE_EVENT_UID3(a,b) \ | 807 #define INTERNAL_TRACE_EVENT_UID3(a,b) \ |
804 trace_event_unique_##a##b | 808 trace_event_unique_##a##b |
805 #define INTERNAL_TRACE_EVENT_UID2(a,b) \ | 809 #define INTERNAL_TRACE_EVENT_UID2(a,b) \ |
806 INTERNAL_TRACE_EVENT_UID3(a,b) | 810 INTERNAL_TRACE_EVENT_UID3(a,b) |
807 #define INTERNAL_TRACE_EVENT_UID(name_prefix) \ | 811 #define INTERNAL_TRACE_EVENT_UID(name_prefix) \ |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 TraceEventSamplingStateScope(const char* category_and_name) { | 1482 TraceEventSamplingStateScope(const char* category_and_name) { |
1479 previous_state_ = TraceEventSamplingStateScope<BucketNumber>::Current(); | 1483 previous_state_ = TraceEventSamplingStateScope<BucketNumber>::Current(); |
1480 TraceEventSamplingStateScope<BucketNumber>::Set(category_and_name); | 1484 TraceEventSamplingStateScope<BucketNumber>::Set(category_and_name); |
1481 } | 1485 } |
1482 | 1486 |
1483 ~TraceEventSamplingStateScope() { | 1487 ~TraceEventSamplingStateScope() { |
1484 TraceEventSamplingStateScope<BucketNumber>::Set(previous_state_); | 1488 TraceEventSamplingStateScope<BucketNumber>::Set(previous_state_); |
1485 } | 1489 } |
1486 | 1490 |
1487 static inline const char* Current() { | 1491 static inline const char* Current() { |
| 1492 // Not supported in split-dll build. http://crbug.com/256965 |
| 1493 #if !defined(CHROME_SPLIT_DLL) |
1488 return reinterpret_cast<const char*>(TRACE_EVENT_API_ATOMIC_LOAD( | 1494 return reinterpret_cast<const char*>(TRACE_EVENT_API_ATOMIC_LOAD( |
1489 g_trace_state[BucketNumber])); | 1495 g_trace_state[BucketNumber])); |
| 1496 #else |
| 1497 return NULL; |
| 1498 #endif |
1490 } | 1499 } |
1491 | 1500 |
1492 static inline void Set(const char* category_and_name) { | 1501 static inline void Set(const char* category_and_name) { |
| 1502 // Not supported in split-dll build. http://crbug.com/256965 |
| 1503 #if !defined(CHROME_SPLIT_DLL) |
1493 TRACE_EVENT_API_ATOMIC_STORE( | 1504 TRACE_EVENT_API_ATOMIC_STORE( |
1494 g_trace_state[BucketNumber], | 1505 g_trace_state[BucketNumber], |
1495 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( | 1506 reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( |
1496 const_cast<char*>(category_and_name))); | 1507 const_cast<char*>(category_and_name))); |
| 1508 #endif |
1497 } | 1509 } |
1498 | 1510 |
1499 private: | 1511 private: |
1500 const char* previous_state_; | 1512 const char* previous_state_; |
1501 }; | 1513 }; |
1502 | 1514 |
1503 } // namespace trace_event_internal | 1515 } // namespace trace_event_internal |
1504 | 1516 |
1505 namespace base { | 1517 namespace base { |
1506 namespace debug { | 1518 namespace debug { |
(...skipping 21 matching lines...) Expand all Loading... |
1528 const char* name_; | 1540 const char* name_; |
1529 IDType id_; | 1541 IDType id_; |
1530 | 1542 |
1531 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); | 1543 DISALLOW_COPY_AND_ASSIGN(TraceScopedTrackableObject); |
1532 }; | 1544 }; |
1533 | 1545 |
1534 } // namespace debug | 1546 } // namespace debug |
1535 } // namespace base | 1547 } // namespace base |
1536 | 1548 |
1537 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ | 1549 #endif /* BASE_DEBUG_TRACE_EVENT_H_ */ |
OLD | NEW |