| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 #ifndef SRC_TRACING_TRACE_EVENT_H_ | 5 #ifndef SRC_TRACING_TRACE_EVENT_H_ |
| 6 #define SRC_TRACING_TRACE_EVENT_H_ | 6 #define SRC_TRACING_TRACE_EVENT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/trace_event/common/trace_event_common.h" | 10 #include "base/trace_event/common/trace_event_common.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Set the duration field of a COMPLETE trace event. | 126 // Set the duration field of a COMPLETE trace event. |
| 127 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 127 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
| 128 // const uint8_t* category_group_enabled, | 128 // const uint8_t* category_group_enabled, |
| 129 // const char* name, | 129 // const char* name, |
| 130 // uint64_t id) | 130 // uint64_t id) |
| 131 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ | 131 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ |
| 132 v8::internal::tracing::TraceEventHelper::GetCurrentPlatform() \ | 132 v8::internal::tracing::TraceEventHelper::GetCurrentPlatform() \ |
| 133 ->UpdateTraceEventDuration | 133 ->UpdateTraceEventDuration |
| 134 | 134 |
| 135 // Defines atomic operations used internally by the tracing system. | 135 // Defines atomic operations used internally by the tracing system. |
| 136 #define TRACE_EVENT_API_ATOMIC_BYTE v8::base::Atomic8 | |
| 137 #define TRACE_EVENT_API_ATOMIC_WORD v8::base::AtomicWord | 136 #define TRACE_EVENT_API_ATOMIC_WORD v8::base::AtomicWord |
| 138 #define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::NoBarrier_Load(&(var)) | 137 #define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::NoBarrier_Load(&(var)) |
| 139 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \ | 138 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \ |
| 140 v8::base::NoBarrier_Store(&(var), (value)) | 139 v8::base::NoBarrier_Store(&(var), (value)) |
| 141 | 140 |
| 142 // The thread buckets for the sampling profiler. | 141 // The thread buckets for the sampling profiler. |
| 143 extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; | 142 extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; |
| 144 | 143 |
| 145 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ | 144 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ |
| 146 g_trace_state[thread_bucket] | 145 g_trace_state[thread_bucket] |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 587 } |
| 589 | 588 |
| 590 private: | 589 private: |
| 591 const char* previous_state_; | 590 const char* previous_state_; |
| 592 }; | 591 }; |
| 593 | 592 |
| 594 } // namespace tracing | 593 } // namespace tracing |
| 595 } // namespace internal | 594 } // namespace internal |
| 596 } // namespace v8 | 595 } // namespace v8 |
| 597 | 596 |
| 598 // V8 Specific macros | |
| 599 | |
| 600 // Runtime calls happen at a high frequency, the following set of macros | |
| 601 // minimizes the tracing overhead of those calls. A global variable is set | |
| 602 // when top level V8 API is called, and checked per runtime call. | |
| 603 extern TRACE_EVENT_API_ATOMIC_BYTE g_runtime_calls_trace_enabled; | |
| 604 | |
| 605 #define TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED() \ | |
| 606 TRACE_EVENT_API_ATOMIC_LOAD(g_runtime_calls_trace_enabled) | |
| 607 | |
| 608 #define TRACE_CHECK_AND_SET_RUNTIME_CALLS_TRACING() \ | |
| 609 do { \ | |
| 610 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO( \ | |
| 611 TRACE_DISABLED_BY_DEFAULT("v8.runtime")); \ | |
| 612 TRACE_EVENT_API_ATOMIC_STORE(g_runtime_calls_trace_enabled, \ | |
| 613 INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() ? 1 \ | |
| 614 : 0); \ | |
| 615 } while (0) | |
| 616 | |
| 617 #define TRACE_RUNTIME_CALL(name) \ | |
| 618 do { \ | |
| 619 if (V8_UNLIKELY(TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED())) { \ | |
| 620 INTERNAL_TRACE_EVENT_ADD_SCOPED(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ | |
| 621 name); \ | |
| 622 } \ | |
| 623 } while (0) | |
| 624 | |
| 625 #endif // SRC_TRACING_TRACE_EVENT_H_ | 597 #endif // SRC_TRACING_TRACE_EVENT_H_ |
| OLD | NEW |