Skip to content

feat: support ${pid} placeholder in --cpu-prof-name #59072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

haramj
Copy link

@haramj haramj commented Jul 14, 2025

This patch adds support for runtime substitution of the ${pid} placeholder
in the --cpu-prof-name option. This is helpful when using cluster/forked
processes to avoid profile file name collisions.

Previously, patterns like ${pid} were not substituted. Now, ${pid} will
be replaced with the current process ID.

Example:
node --cpu-prof --cpu-prof-name 'CPU.${pid}.cpuprofile' index.js

Generates: CPU.12345.cpuprofile

Also updated the CLI documentation accordingly.

Fixes: #57418

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/inspector

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run. labels Jul 14, 2025
@haramj haramj closed this Jul 14, 2025
@haramj haramj reopened this Jul 14, 2025
@haramj
Copy link
Author

haramj commented Jul 14, 2025

I didn’t modify the affected section in cli.md, but the build fails with a link not found error. It seems to be an issue related to the documentation build tooling or other files, not my changes.

@theanarkh
Copy link
Contributor

Please run CLANG_FORMAT_START=$(git merge-base HEAD main) make format-cpp on your PC and change commit message to src: xxx.

Copy link

codecov bot commented Jul 14, 2025

Codecov Report

Attention: Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.

Project coverage is 90.07%. Comparing base (049664b) to head (b3b8067).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/inspector_profiler.cc 64.28% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59072      +/-   ##
==========================================
+ Coverage   90.06%   90.07%   +0.01%     
==========================================
  Files         645      645              
  Lines      189130   189144      +14     
  Branches    37094    37095       +1     
==========================================
+ Hits       170339   170375      +36     
+ Misses      11511    11476      -35     
- Partials     7280     7293      +13     
Files with missing lines Coverage Δ
src/inspector_profiler.cc 79.79% <64.28%> (-0.57%) ⬇️

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

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++. inspector Issues and PRs related to the V8 inspector protocol needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--cpu-prof-name 'CPU.${pid}.cpuprofile' doesn't replace the placeholder
3 participants