| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 namespace v8 { | 285 namespace v8 { |
| 286 namespace internal { | 286 namespace internal { |
| 287 namespace tracing { | 287 namespace tracing { |
| 288 | 288 |
| 289 // Specify these values when the corresponding argument of AddTraceEvent is not | 289 // Specify these values when the corresponding argument of AddTraceEvent is not |
| 290 // used. | 290 // used. |
| 291 const int kZeroNumArgs = 0; | 291 const int kZeroNumArgs = 0; |
| 292 const decltype(nullptr) kGlobalScope = nullptr; | 292 const decltype(nullptr) kGlobalScope = nullptr; |
| 293 const uint64_t kNoId = 0; | 293 const uint64_t kNoId = 0; |
| 294 | 294 |
| 295 extern int kRuntimeCallsTracingEnabled; | |
| 296 | |
| 297 class TraceEventHelper { | 295 class TraceEventHelper { |
| 298 public: | 296 public: |
| 299 static v8::Platform* GetCurrentPlatform(); | 297 static v8::Platform* GetCurrentPlatform(); |
| 300 }; | 298 }; |
| 301 | 299 |
| 302 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers | 300 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers |
| 303 // are by default mangled with the Process ID so that they are unlikely to | 301 // are by default mangled with the Process ID so that they are unlikely to |
| 304 // collide when the same pointer is used on different processes. | 302 // collide when the same pointer is used on different processes. |
| 305 class TraceID { | 303 class TraceID { |
| 306 public: | 304 public: |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 587 } |
| 590 | 588 |
| 591 private: | 589 private: |
| 592 const char* previous_state_; | 590 const char* previous_state_; |
| 593 }; | 591 }; |
| 594 | 592 |
| 595 } // namespace tracing | 593 } // namespace tracing |
| 596 } // namespace internal | 594 } // namespace internal |
| 597 } // namespace v8 | 595 } // namespace v8 |
| 598 | 596 |
| 599 // V8 Specific macros | |
| 600 #define TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED() \ | |
| 601 v8::internal::tracing::kRuntimeCallsTracingEnabled == 1 | |
| 602 | |
| 603 #define TRACE_CHECK_AND_SET_RUNTIME_CALLS_TRACING() \ | |
| 604 do { \ | |
| 605 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO( \ | |
| 606 TRACE_DISABLED_BY_DEFAULT("v8.runtime")); \ | |
| 607 v8::internal::tracing::kRuntimeCallsTracingEnabled = \ | |
| 608 INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() ? 1 \ | |
| 609 : 0; \ | |
| 610 } while (0) | |
| 611 | |
| 612 #define TRACE_RUNTIME_CALL(name) \ | |
| 613 do { \ | |
| 614 if (V8_UNLIKELY(TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED())) { \ | |
| 615 INTERNAL_TRACE_EVENT_ADD_SCOPED(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ | |
| 616 name); \ | |
| 617 } \ | |
| 618 } while (0) | |
| 619 | |
| 620 #endif // SRC_TRACING_TRACE_EVENT_H_ | 597 #endif // SRC_TRACING_TRACE_EVENT_H_ |
| OLD | NEW |