Skip to content

build: enable Perfetto by default - #65794

Open
aduh95 wants to merge 3 commits into
nodejs:mainfrom
aduh95:perfetto-sdk
Open

build: enable Perfetto by default#65794
aduh95 wants to merge 3 commits into
nodejs:mainfrom
aduh95:perfetto-sdk

Conversation

@aduh95

@aduh95 aduh95 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@aduh95 aduh95 added the semver-major PRs that contain breaking changes and should be released in the next major version. label Sep 4, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. labels Sep 4, 2026
@aduh95

This comment was marked as resolved.

@StefanStojanovic

Copy link
Copy Markdown
Contributor

@aduh95, I'll look into Windows failures.

@StefanStojanovic

StefanStojanovic commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This is what got it to compile for me locally. In short, it was a configuration problem(s), so gyp changes resolved it all.

Details
From f31ec1fc602e9711756d9ca1d7ae386221e14662 Mon Sep 17 00:00:00 2001
From: StefanStojanovic <stefan.stojanovic@janeasystems.com>
Date: Wed, 9 Sep 2026 08:24:06 +0200
Subject: [PATCH] build,win: fix Perfetto

Signed-off-by: StefanStojanovic <stefan.stojanovic@janeasystems.com>
---
 deps/perfetto/perfetto.gyp | 8 ++++++++
 node.gypi                  | 5 +++++
 tools/v8_gypfiles/v8.gyp   | 6 +++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/deps/perfetto/perfetto.gyp b/deps/perfetto/perfetto.gyp
index 083d0b386dd..697256401a3 100644
--- a/deps/perfetto/perfetto.gyp
+++ b/deps/perfetto/perfetto.gyp
@@ -18,6 +18,14 @@
       'sources': [
         '<@(perfetto_sdk_sources)',
       ],
+      'conditions': [
+        ['OS=="win"', {
+          'defines': [
+            'WIN32_LEAN_AND_MEAN',
+            'NOMINMAX',
+          ],
+        }],
+      ],
     },
   ]
 }
diff --git a/node.gypi b/node.gypi
index 104e884e661..1ca77fa3fee 100644
--- a/node.gypi
+++ b/node.gypi
@@ -93,6 +93,11 @@
     [ 'OS=="linux" and target_arch=="s390x"', {
       'cflags': [ '-march=z14' ],
     }],
+    [ 'v8_use_perfetto==1', {
+      'dependencies': [
+        'deps/perfetto/perfetto.gyp:perfetto_sdk',
+      ],
+    }],
     [ 'node_enable_d8=="true"', {
       'dependencies': [ 'tools/v8_gypfiles/d8.gyp:d8' ],
     }],
diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
index a976148ddab..2b1ee51c8f1 100644
--- a/tools/v8_gypfiles/v8.gyp
+++ b/tools/v8_gypfiles/v8.gyp
@@ -1758,7 +1758,11 @@
         }],
         ['v8_use_perfetto==1', {
           'sources!': [
-            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_libplatform.*?v8_use_perfetto.*?sources \\-= ")',
+            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
+            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
+            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
+            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
+            '<(V8_ROOT)/src/tracing/trace-event-no-perfetto.h',
           ],
           'sources': [
             '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_libplatform.*?v8_use_perfetto.*?sources \\+= ")',
-- 
2.45.2.windows.1

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

aduh95 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@nodejs/platform-aix Build failure: ../deps/perfetto/sdk/perfetto.h:1035:5: error: function-like macro 'PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE' is not defined

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@richardlau

Copy link
Copy Markdown
Member

@nodejs/platform-aix Build failure: ../deps/perfetto/sdk/perfetto.h:1035:5: error: function-like macro 'PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE' is not defined

I think the actual error is this:
e.g. https://ci.nodejs.org/job/node-test-commit-aix/65261/nodes=aix72-power9/console

01:02:46 In file included from ../deps/perfetto/sdk/perfetto.cc:21:
01:02:46 ../deps/perfetto/sdk/perfetto.h:295:2: error: OS not supported (see build_config.h)
01:02:46   295 | #error OS not supported (see build_config.h)
01:02:46       |  ^

Same failure is seen on SmartOS.

@jasnell

jasnell commented Sep 10, 2026

Copy link
Copy Markdown
Member

doh!

@aduh95

aduh95 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

How should we proceed? Force --without-perfetto for those platforms or wait until support is added upstream? @nodejs/platform-aix @nodejs/platform-smartos

@jasnell

jasnell commented Sep 10, 2026

Copy link
Copy Markdown
Member

good question. I think as long as the observable behavior with trace events is still the same either way, forcing --without-perfetto on those platforms is likely ok. We'd need to avoid a case where tracing output is broken on just those. If we still consider this experimental, then it should be fine omitting the unsupported platforms, however.

StefanStojanovic and others added 3 commits September 10, 2026 22:48
Signed-off-by: StefanStojanovic <stefan.stojanovic@janeasystems.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
except on incompatible platforms
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants