Skip to content

src: add perfetto trace agent - #64565

Closed
legendecas wants to merge 6 commits into
nodejs:mainfrom
legendecas:perfetto-build-sdk
Closed

src: add perfetto trace agent#64565
legendecas wants to merge 6 commits into
nodejs:mainfrom
legendecas:perfetto-build-sdk

Conversation

@legendecas

@legendecaslegendecas commented Jul 17, 2026

Copy link
Copy Markdown
Member

This implements the Perfetto tracing support. The support is enabled with configure flag --with-perfetto.

A perfetto trace is written to files like node_trace.1.pftrace (protobuf encoded) by default, when the trace is enabled. Trace files can be viewed on https://ui.perfetto.dev/. JSON output is intentionally not supported.

As of this PR, when perfetto is enabled, inspector trace support is disabled. Supporting perfetto in inspector would need change to the inspector protocol to deliver raw bytes directly, instead of protocol object values.

Refs: nodejs/diagnostics#654

@nodejs-github-bot

nodejs-github-bot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/gyp
  • @nodejs/inspector
  • @nodejs/cpp-reviewers
  • @nodejs/diagnostics

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 17, 2026
@legendecaslegendecas added trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. c++ Issues and PRs that require attention from people who are familiar with C++. v8 engine Issues and PRs related to the V8 dependency. labels Jul 17, 2026
@legendecas
legendecasforce-pushed the perfetto-build-sdk branch 6 times, most recently from 7c5702c to edae450CompareJuly 17, 2026 21:00
@codecov

codecovBot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.76068% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.13%. Comparing base (4bec191) to head (df7e4de).
⚠️ Report is 41 commits behind head on main.

Files with missing linesPatch %Lines
src/tracing/trace_event_legacy_inl.h78.33%16 Missing and 10 partials ⚠️
lib/internal/trace_events.js91.07%5 Missing ⚠️
src/node_dir.cc54.54%0 Missing and 5 partials ⚠️
src/tracing/agent.h0.00%2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #64565 +/- ##
=======================================
Coverage 90.13% 90.13% =======================================
Files 741 743 +2 Lines 242106 242168 +62 Branches 45551 45595 +44 =======================================
+ Hits 218211 218276 +65 + Misses 15430 15404 -26 - Partials 8465 8488 +23 
Files with missing linesCoverage Δ
lib/internal/console/constructor.js98.18% <100.00%> (-0.01%)⬇️
lib/internal/constants.js98.27% <100.00%> (+0.06%)⬆️
lib/internal/http.js92.33% <100.00%> (+0.05%)⬆️
lib/internal/trace_events_async_hooks.js93.81% <100.00%> (-0.13%)⬇️
lib/internal/util/debuglog.js95.32% <100.00%> (+0.01%)⬆️
src/inspector_agent.cc80.52% <ø> (ø)
src/node_constants.cc99.71% <ø> (-0.01%)⬇️
src/node_file.cc74.23% <ø> (ø)
src/node_internals.h80.35% <ø> (ø)
src/node_options.h97.51% <ø> (-0.50%)⬇️
... and 11 more

... and 51 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.

@legendecas
legendecasforce-pushed the perfetto-build-sdk branch 2 times, most recently from 450a910 to ada6a01CompareJuly 20, 2026 18:33
@legendecas

Copy link
Copy Markdown
MemberAuthor

CI failure is related to #64633.

Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
Comment threadsrc/tracing/agent_perfetto.cc Outdated
Comment threadsrc/tracing/agent_perfetto.h Outdated
@legendecaslegendecas added dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Jul 22, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64565
Refs: nodejs/diagnostics#654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64565
Refs: nodejs/diagnostics#654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64565
Refs: nodejs/diagnostics#654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64565
Refs: nodejs/diagnostics#654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64565
Refs: nodejs/diagnostics#654
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ryuhei Shima <shimaryuhei@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
nodejs-github-bot added a commit that referenced this pull request Aug 4, 2026
Notable changes:
build:
* (SEMVER-MINOR) perfetto-sdk (Chengzhong Wu) #64565
crypto:
* (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
* update root certificates to NSS 3.125 (Node.js GitHub Bot) #64746
doc:
* (SEMVER-MINOR) formalize fn/name as part of TestOptions API (Christopher Hiller) #64946
lib:
* (SEMVER-MINOR) add perfetto support (Chengzhong Wu) #64565
module:
* (SEMVER-MINOR) implement Symbol.dispose in ModuleHooks (Remco Haszing) #63928
net:
* (SEMVER-MINOR) add experimental net/promises API (Ethan Arrowood) #63965
src:
* (SEMVER-MINOR) add perfetto trace agent (Chengzhong Wu) #64565
* (SEMVER-MINOR) rename legacy trace event headers (Chengzhong Wu) #64565
* (SEMVER-MINOR) fix trace macro compatibility (Chengzhong Wu) #64565
test_runner:
* (SEMVER-MINOR) add support for --test-coverage-include-all (avivkeller) #64830
PR-URL: #65027
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Notable changes:
crypto:
* (SEMVER-MINOR) support loading private keys through STORE loaders (Filip Skokan) #63949
* update root certificates to NSS 3.125 (Node.js GitHub Bot) #64746
lib:
* (SEMVER-MINOR) add perfetto support (Chengzhong Wu) #64565
module:
* (SEMVER-MINOR) implement `Symbol.dispose` in ModuleHooks (Remco Haszing) #63928
net:
* (SEMVER-MINOR) add experimental `node:net/promises` API (Ethan Arrowood) #63965
test_runner:
* (SEMVER-MINOR) add support for `--test-coverage-include-all` (avivkeller) #64830
PR-URL: #65027
ckerr added a commit to electron/electron that referenced this pull request Aug 4, 2026
Backport Node's Perfetto tracing agent now that Chromium V8 no longer exposes the legacy tracing controller APIs.
Ref: nodejs/node#64565
Ref: nodejs/node#64721
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 4, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 4, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 4, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 5, 2026
Backport Node's Perfetto tracing agent now that Chromium V8 no longer exposes the legacy tracing controller APIs.
Ref: nodejs/node#64565
Ref: nodejs/node#64721
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 5, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 5, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 5, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
ckerr added a commit to electron/electron that referenced this pull request Aug 5, 2026
Ref: nodejs/node#64565
Co-Authored-By: GitHub Copilot <copilot@github.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 5, 2026
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: #64721Fixes: nodejs/diagnostics#654
Refs: #64565
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.commit-queue-rebaseAdd this label to allow the Commit Queue to land a PR in several commits.dont-land-on-v22.xPRs that should not land on the v22.x-staging branch and should not be released in v22.x.dont-land-on-v24.xPRs that should not land on the v24.x-staging branch and should not be released in v24.x.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.semver-minorPRs that contain new features and should be released in the next minor version.trace_eventsIssues and PRs related to V8, Node.js core, and userspace code trace events.v8 engineIssues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@legendecas@nodejs-github-bot@jasnell@islandryu@richardlau