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 |
295 class TraceEventHelper { | 297 class TraceEventHelper { |
296 public: | 298 public: |
297 static v8::Platform* GetCurrentPlatform(); | 299 static v8::Platform* GetCurrentPlatform(); |
298 }; | 300 }; |
299 | 301 |
300 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers | 302 // TraceID encapsulates an ID that can either be an integer or pointer. Pointers |
301 // are by default mangled with the Process ID so that they are unlikely to | 303 // are by default mangled with the Process ID so that they are unlikely to |
302 // collide when the same pointer is used on different processes. | 304 // collide when the same pointer is used on different processes. |
303 class TraceID { | 305 class TraceID { |
304 public: | 306 public: |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 589 } |
588 | 590 |
589 private: | 591 private: |
590 const char* previous_state_; | 592 const char* previous_state_; |
591 }; | 593 }; |
592 | 594 |
593 } // namespace tracing | 595 } // namespace tracing |
594 } // namespace internal | 596 } // namespace internal |
595 } // namespace v8 | 597 } // namespace v8 |
596 | 598 |
| 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 |
597 #endif // SRC_TRACING_TRACE_EVENT_H_ | 620 #endif // SRC_TRACING_TRACE_EVENT_H_ |
OLD | NEW |