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
@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.14%. Comparing base (00917ba) to head (ada6a01).
⚠️ Report is 2 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.14%   90.14%           
=======================================
  Files         741      743    +2     
  Lines      242076   242131   +55     
  Branches    45558    45552    -6     
=======================================
+ Hits       218216   218270   +54     
+ Misses      15385    15376    -9     
- Partials     8475     8485   +10     
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% <ø> (ø)
src/node_internals.h 80.35% <ø> (ø)
src/node_options.h 98.00% <ø> (ø)
... and 11 more

... and 28 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
legendecas force-pushed the perfetto-build-sdk branch from edae450 to 450a910 Compare July 18, 2026 01:28
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>
@legendecas
legendecas force-pushed the perfetto-build-sdk branch from 450a910 to ada6a01 Compare July 20, 2026 18:33
@legendecas

Copy link
Copy Markdown
Member Author

CI failure is related to #64633.

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