cli: allow --cpu-prof* in NODE_OPTIONS

Fixes: https://github.com/nodejs/node/issues/56944
PR-URL: https://github.com/nodejs/node/pull/57018
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Carlos Espa 2025-02-20 11:11:01 +01:00 committed by GitHub
parent 1dc882d6a0
commit 15fec136e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 4 deletions

View File

@ -3176,6 +3176,10 @@ one is included in the list below.
* `--allow-wasi`
* `--allow-worker`
* `--conditions`, `-C`
* `--cpu-prof-dir`
* `--cpu-prof-interval`
* `--cpu-prof-name`
* `--cpu-prof`
* `--diagnostic-dir`
* `--disable-proto`
* `--disable-sigusr1`

View File

@ -614,19 +614,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"Start the V8 CPU profiler on start up, and write the CPU profile "
"to disk before exit. If --cpu-prof-dir is not specified, write "
"the profile to the current working directory.",
&EnvironmentOptions::cpu_prof);
&EnvironmentOptions::cpu_prof,
kAllowedInEnvvar);
AddOption("--cpu-prof-name",
"specified file name of the V8 CPU profile generated with "
"--cpu-prof",
&EnvironmentOptions::cpu_prof_name);
&EnvironmentOptions::cpu_prof_name,
kAllowedInEnvvar);
AddOption("--cpu-prof-interval",
"specified sampling interval in microseconds for the V8 CPU "
"profile generated with --cpu-prof. (default: 1000)",
&EnvironmentOptions::cpu_prof_interval);
&EnvironmentOptions::cpu_prof_interval,
kAllowedInEnvvar);
AddOption("--cpu-prof-dir",
"Directory where the V8 profiles generated by --cpu-prof will be "
"placed. Does not affect --prof.",
&EnvironmentOptions::cpu_prof_dir);
&EnvironmentOptions::cpu_prof_dir,
kAllowedInEnvvar);
AddOption("--experimental-network-inspection",
"experimental network inspection support",
&EnvironmentOptions::experimental_network_inspection);

View File

@ -93,6 +93,10 @@ const difference = (setA, setB) => {
// Refs: https://github.com/nodejs/node/pull/54259#issuecomment-2308256647
if (!process.features.inspector) {
[
'--cpu-prof-dir',
'--cpu-prof-interval',
'--cpu-prof-name',
'--cpu-prof',
'--heap-prof-dir',
'--heap-prof-interval',
'--heap-prof-name',