@@ -285,22 +285,8 @@ index 8f053efe93324b9acbb4e85f7b974b4f7712e200..e331ed5567caa39ade90ce28cea69f1d
285285 void NodeTraceWriter::FlushPrivate() {
286286 std::string str;
287287 int highest_request_id;
288- diff --git a/src/tracing/node_trace_writer.h b/src/tracing/node_trace_writer.h
289- index cd965d77b7859ff2edcf781a934594b5a9b6d251..fe1714ba77fddef693d37eeb8c7a196ddfd15c26 100644
290- --- a/src/tracing/node_trace_writer.h
291- +++ b/src/tracing/node_trace_writer.h
292- @@ -20,7 +20,9 @@ class NodeTraceWriter : public AsyncTraceWriter {
293- ~NodeTraceWriter() override;
294-
295- void InitializeOnThread(uv_loop_t* loop) override;
296- + #ifndef V8_USE_PERFETTO
297- void AppendTraceEvent(TraceObject* trace_event) override;
298- + #endif
299- void Flush(bool blocking) override;
300-
301- static const int kTracesPerFile = 1 << 19;
302288diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h
303- index be0f55a409a71bf9c1763c36fdc252857228742e..827b5330b2f8c545338a46c548f8abf4aab7f50c 100644
289+ index a662a081dc3bf356bf93e4063fcb043e4d8df07b..c89cdfe2b2681fbf9946200a03d7d1f7bad21226 100644
304290--- a/src/tracing/trace_event.h
305291+++ b/src/tracing/trace_event.h
306292@@ -69,8 +69,16 @@ enum CategoryGroupEnabledFlags {
@@ -336,36 +322,31 @@ index be0f55a409a71bf9c1763c36fdc252857228742e..827b5330b2f8c545338a46c548f8abf4
336322
337323 // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method
338324 // on the convertable value will be called at flush time.
339- @@ -319,10 +332,13 @@ class TraceEventHelper {
325+ @@ -319,12 +332,15 @@ class TraceEventHelper {
340326 static void SetAgent(Agent* agent);
341327
342328 static inline const uint8_t* GetCategoryGroupEnabled(const char* group) {
343329+ #ifndef V8_USE_PERFETTO
344330 v8::TracingController* controller = GetTracingController();
345331 static const uint8_t disabled = 0;
346- if (UNLIKELY(controller == nullptr)) return &disabled;
332+ if (controller == nullptr) [[unlikely]] {
333+ return &disabled;
334+ }
347335 return controller->GetCategoryGroupEnabled(group);
348336+ #endif
349337+ return 0;
350338 }
351339 };
352340
353- @@ -460 ,6 +476 ,7 @@ static inline uint64_t AddTraceEventImpl(
341+ @@ -462 ,6 +478 ,7 @@ static inline uint64_t AddTraceEventImpl(
354342 const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
355343 const char** arg_names, const uint8_t* arg_types,
356344 const uint64_t* arg_values, unsigned int flags) {
357345+ #ifndef V8_USE_PERFETTO
358346 std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertibles[2];
359347 if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
360348 arg_convertibles[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
361- @@ -469,13 +486,14 @@ static inline uint64_t AddTraceEventImpl(
362- arg_convertibles[1].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
363- static_cast<intptr_t>(arg_values[1])));
364- }
365- - // DCHECK(num_args, 2);
366- v8::TracingController* controller =
367- node::tracing::TraceEventHelper::GetTracingController();
368- if (controller == nullptr) return 0;
349+ @@ -478,6 +495,8 @@ static inline uint64_t AddTraceEventImpl(
369350 return controller->AddTraceEvent(phase, category_group_enabled, name, scope, id,
370351 bind_id, num_args, arg_names, arg_types,
371352 arg_values, arg_convertibles, flags);
@@ -374,25 +355,18 @@ index be0f55a409a71bf9c1763c36fdc252857228742e..827b5330b2f8c545338a46c548f8abf4
374355 }
375356
376357 static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
377- @@ -483 ,6 +501 ,7 @@ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
358+ @@ -485 ,6 +504 ,7 @@ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
378359 const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
379360 const char** arg_names, const uint8_t* arg_types,
380361 const uint64_t* arg_values, unsigned int flags, int64_t timestamp) {
381362+ #ifndef V8_USE_PERFETTO
382- std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertables [2];
363+ std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertibles [2];
383364 if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
384- arg_convertables[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
385- @@ -492,19 +511,21 @@ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
386- arg_convertables[1].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
387- static_cast<intptr_t>(arg_values[1])));
388- }
389- - // DCHECK_LE(num_args, 2);
390- v8::TracingController* controller =
391- node::tracing::TraceEventHelper::GetTracingController();
392- if (controller == nullptr) return 0;
365+ arg_convertibles[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
366+ @@ -501,12 +521,15 @@ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
393367 return controller->AddTraceEventWithTimestamp(
394368 phase, category_group_enabled, name, scope, id, bind_id, num_args,
395- arg_names, arg_types, arg_values, arg_convertables , flags, timestamp);
369+ arg_names, arg_types, arg_values, arg_convertibles , flags, timestamp);
396370+ #endif
397371+ return 0;
398372 }
@@ -405,11 +379,12 @@ index be0f55a409a71bf9c1763c36fdc252857228742e..827b5330b2f8c545338a46c548f8abf4
405379 std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertibles[2];
406380 if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
407381 arg_convertibles[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
408- @@ -520 ,6 +541 ,7 @@ static V8_INLINE void AddMetadataEventImpl(
382+ @@ -522 ,6 +545 ,7 @@ static V8_INLINE void AddMetadataEventImpl(
409383 return agent->GetTracingController()->AddMetadataEvent(
410384 category_group_enabled, name, num_args, arg_names, arg_types, arg_values,
411385 arg_convertibles, flags);
412386+ #endif
413387 }
414388
415389 // Define SetTraceValue for each allowed type. It stores the type and
390+
0 commit comments