Skip to content

src: add perfetto trace agent#64565

Open
legendecas wants to merge 5 commits into
nodejs:mainfrom
legendecas:perfetto-build-sdk
Open

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

Conversation

@legendecas

@legendecas legendecas 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-bot nodejs-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
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
@legendecas
legendecas force-pushed the perfetto-build-sdk branch from 8213a32 to 5745cc2 Compare July 17, 2026 19:59
@legendecas legendecas 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
legendecas force-pushed the perfetto-build-sdk branch 6 times, most recently from 7c5702c to edae450 Compare July 17, 2026 21:00
@codecov

codecov Bot 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.23%. Comparing base (89df046) to head (450a910).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/tracing/trace_event_legacy_inl.h 78.33% 16 Missing and 10 partials ⚠️
lib/internal/trace_events.js 91.07% 5 Missing ⚠️
src/node_dir.cc 54.54% 0 Missing and 5 partials ⚠️
src/tracing/agent.h 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64565      +/-   ##
==========================================
- Coverage   90.23%   90.23%   -0.01%     
==========================================
  Files         739      741       +2     
  Lines      241744   241827      +83     
  Branches    45564    45576      +12     
==========================================
+ Hits       218149   218202      +53     
- Misses      15115    15164      +49     
+ Partials     8480     8461      -19     
Files with missing lines Coverage Δ
lib/internal/console/constructor.js 98.18% <100.00%> (-0.01%) ⬇️
lib/internal/constants.js 98.27% <100.00%> (+0.06%) ⬆️
lib/internal/http.js 92.33% <100.00%> (+0.05%) ⬆️
lib/internal/trace_events_async_hooks.js 93.81% <100.00%> (-0.13%) ⬇️
lib/internal/util/debuglog.js 95.32% <100.00%> (+0.01%) ⬆️
src/inspector_agent.cc 80.52% <ø> (ø)
src/node_constants.cc 99.71% <ø> (-0.01%) ⬇️
src/node_file.cc 74.19% <ø> (+0.03%) ⬆️
src/node_internals.h 80.35% <ø> (ø)
src/node_options.h 98.01% <ø> (ø)
... and 11 more

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

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>
@legendecas
legendecas force-pushed the perfetto-build-sdk branch from edae450 to 450a910 Compare July 18, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants