| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,8 +70,7 @@ enum CategoryGroupEnabledFlags { | |||
| 70 | 70 | // const uint8_t* | |
| 71 | 71 | // TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(const char* category_group) | |
| 72 | 72 | #define TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED \ | |
| 73 | - node::tracing::TraceEventHelper::GetTracingController() \ | ||
| 74 | - ->GetCategoryGroupEnabled | ||
| 73 | + node::tracing::TraceEventHelper::GetCategoryGroupEnabled | ||
| 75 | 74 | ||
| 76 | 75 | // Get the number of times traces have been recorded. This is used to implement | |
| 77 | 76 | // the TRACE_EVENT_IS_NEW_TRACE facility. | |
@@ -115,9 +114,10 @@ enum CategoryGroupEnabledFlags { | |||
| 115 | 114 | // const uint8_t* category_group_enabled, | |
| 116 | 115 | // const char* name, | |
| 117 | 116 | // uint64_t id) | |
| 118 | - #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ | ||
| 119 | - node::tracing::TraceEventHelper::GetTracingController() \ | ||
| 120 | - ->UpdateTraceEventDuration | ||
| 117 | + #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ | ||
| 118 | + if (auto controller = \ | ||
| 119 | + node::tracing::TraceEventHelper::GetTracingController()) \ | ||
| 120 | + controller->UpdateTraceEventDuration | ||
| 121 | 121 | ||
| 122 | 122 | // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method | |
| 123 | 123 | // on the convertable value will be called at flush time. | |
@@ -319,6 +319,13 @@ class NODE_EXTERN TraceEventHelper { | |||
| 319 | 319 | ||
| 320 | 320 | static Agent* GetAgent(); | |
| 321 | 321 | static void SetAgent(Agent* agent); | |
| 322 | + | ||
| 323 | + static inline const uint8_t* GetCategoryGroupEnabled(const char* group) { | ||
| 324 | + v8::TracingController* controller = GetTracingController(); | ||
| 325 | + static const uint8_t disabled = 0; | ||
| 326 | + if (UNLIKELY(controller == nullptr)) return &disabled; | ||
| 327 | + return controller->GetCategoryGroupEnabled(group); | ||
| 328 | + } | ||
| 322 | 329 | }; | |
| 323 | 330 | ||
| 324 | 331 | // TraceID encapsulates an ID that can either be an integer or pointer. Pointers | |
@@ -467,6 +474,7 @@ static inline uint64_t AddTraceEventImpl( | |||
| 467 | 474 | // DCHECK(num_args, 2); | |
| 468 | 475 | v8::TracingController* controller = | |
| 469 | 476 | node::tracing::TraceEventHelper::GetTracingController(); | |
| 477 | + if (controller == nullptr) return 0; | ||
| 470 | 478 | return controller->AddTraceEvent(phase, category_group_enabled, name, scope, id, | |
| 471 | 479 | bind_id, num_args, arg_names, arg_types, | |
| 472 | 480 | arg_values, arg_convertibles, flags); | |
@@ -489,6 +497,7 @@ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl( | |||
| 489 | 497 | // DCHECK_LE(num_args, 2); | |
| 490 | 498 | v8::TracingController* controller = | |
| 491 | 499 | node::tracing::TraceEventHelper::GetTracingController(); | |
| 500 | + if (controller == nullptr) return 0; | ||
| 492 | 501 | return controller->AddTraceEventWithTimestamp( | |
| 493 | 502 | phase, category_group_enabled, name, scope, id, bind_id, num_args, | |
| 494 | 503 | arg_names, arg_types, arg_values, arg_convertables, flags, timestamp); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments