Skip to content

build: enable Perfetto by default - #65794

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

aduh95 wants to merge 6 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.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95 aduh95 added the tsc-agenda Issues and PRs to discuss during Technical Steering Committee meetings. label Sep 15, 2026
@aduh95

aduh95 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Adding to the TSC agenda to make sure 53d853b has consensus (the alternative would be to block Perfetto enabling until support for all platforms is added upstream)

@saitanallensantiago26-beep

This comment was marked as off-topic.

1 similar comment
@saitanallensantiago26-beep

This comment was marked as off-topic.

@legendecas legendecas added the trace_events Issues and PRs related to trace events from V8, Node.js core, and user code. label Sep 15, 2026
@legendecas

legendecas commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Removing the tsc-agenda label as more works are in process. Feel free to add it back if necessary.

@aduh95

aduh95 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@aduh95 aduh95 added the blocked PRs that are blocked by other issues or PRs. label Sep 24, 2026
LalitMaganti pushed a commit to google/perfetto that referenced this pull request Sep 28, 2026
)

The V8 Js Engine is working towards removing legacy tracing and using
Perfetto instead. Node.js is also enabling it by default:
nodejs/diagnostics#654
nodejs/node#65794

Currently setting `v8_use_perfetto = true` in V8 fails a number of tests
on big-endian platforms which this PR attempts to fix.

The protobuf wire format requires fixed-width fields (fixed32/fixed64,
float/double) to be little-endian. protozero memcpy's them in host
order, so on big-endian (s390x) traces are corrupt and unreadable by
libprotobuf/trace_processor. BE was previously stubbed with `#error`
guards.
@aduh95
aduh95 force-pushed the perfetto-sdk branch 2 times, most recently from adaf43f to 4124575 Compare October 3, 2026 15:03
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.60%. Comparing base (ca277a6) to head (bd93cfb).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65794      +/-   ##
==========================================
- Coverage   90.60%   90.60%   -0.01%     
==========================================
  Files         797      791       -6     
  Lines      278293   277841     -452     
  Branches    53508    53342     -166     
==========================================
- Hits       252141   251730     -411     
- Misses      16522    16633     +111     
+ Partials     9630     9478     -152     

see 63 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aduh95 aduh95 mentioned this pull request Oct 20, 2026
@aduh95
aduh95 force-pushed the perfetto-sdk branch 2 times, most recently from 8d03a56 to 913ad2b Compare October 23, 2026 08:33
@aduh95 aduh95 removed the blocked PRs that are blocked by other issues or PRs. label Oct 23, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95

aduh95 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author
tools/perfetto/get_trace_processor: 30: unzip: not found

Looks like we'll need #66731 first

@aduh95 aduh95 added the blocked PRs that are blocked by other issues or PRs. label Oct 23, 2026
Refs: google/perfetto#7590
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
except on incompatible platforms
add TRACE_PROCESSOR_SHELL_PATH as dependency of JS test
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95 aduh95 added blocked PRs that are blocked by other issues or PRs. and removed blocked PRs that are blocked by other issues or PRs. labels Oct 23, 2026
@aduh95

aduh95 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author
No perfetto release for Linux ppc64le
No perfetto release for Linux s390x
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

I guess we need to disable Perfetto on those platforms

@richardlau

Copy link
Copy Markdown
Member
No perfetto release for Linux ppc64le
No perfetto release for Linux s390x
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

I guess we need to disable Perfetto on those platforms

@miladfarca PRed upstream fixes to Perfetto for Linux on s390x in google/perfetto#7449 (enough to enable Perfetto in V8 builds). The issue here (the "No perfetto release for...") is

# Perfetto names its release archives <os>-<arch>, which does not match what
# platform reports.
OS_NAMES = {'Darwin': 'mac', 'Linux': 'linux'}
ARCH_NAMES = {'x86_64': 'amd64', 'arm64': 'arm64', 'aarch64': 'arm64'}
required for the tests and Google only releasing on arm64 and x64.

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

Labels

blocked PRs that are blocked by other issues or PRs. 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. trace_events Issues and PRs related to trace events from V8, Node.js core, and user code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants