Skip to content

Commit 15fec13

Browse files
authored
cli: allow --cpu-prof* in NODE_OPTIONS
Fixes: #56944 PR-URL: #57018 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 1dc882d commit 15fec13

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

doc/api/cli.md

+4
Original file line numberDiff line numberDiff line change
@@ -3176,6 +3176,10 @@ one is included in the list below.
31763176
* `--allow-wasi`
31773177
* `--allow-worker`
31783178
* `--conditions`, `-C`
3179+
* `--cpu-prof-dir`
3180+
* `--cpu-prof-interval`
3181+
* `--cpu-prof-name`
3182+
* `--cpu-prof`
31793183
* `--diagnostic-dir`
31803184
* `--disable-proto`
31813185
* `--disable-sigusr1`

src/node_options.cc

+8-4
Original file line numberDiff line numberDiff line change
@@ -614,19 +614,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
614614
"Start the V8 CPU profiler on start up, and write the CPU profile "
615615
"to disk before exit. If --cpu-prof-dir is not specified, write "
616616
"the profile to the current working directory.",
617-
&EnvironmentOptions::cpu_prof);
617+
&EnvironmentOptions::cpu_prof,
618+
kAllowedInEnvvar);
618619
AddOption("--cpu-prof-name",
619620
"specified file name of the V8 CPU profile generated with "
620621
"--cpu-prof",
621-
&EnvironmentOptions::cpu_prof_name);
622+
&EnvironmentOptions::cpu_prof_name,
623+
kAllowedInEnvvar);
622624
AddOption("--cpu-prof-interval",
623625
"specified sampling interval in microseconds for the V8 CPU "
624626
"profile generated with --cpu-prof. (default: 1000)",
625-
&EnvironmentOptions::cpu_prof_interval);
627+
&EnvironmentOptions::cpu_prof_interval,
628+
kAllowedInEnvvar);
626629
AddOption("--cpu-prof-dir",
627630
"Directory where the V8 profiles generated by --cpu-prof will be "
628631
"placed. Does not affect --prof.",
629-
&EnvironmentOptions::cpu_prof_dir);
632+
&EnvironmentOptions::cpu_prof_dir,
633+
kAllowedInEnvvar);
630634
AddOption("--experimental-network-inspection",
631635
"experimental network inspection support",
632636
&EnvironmentOptions::experimental_network_inspection);

test/parallel/test-process-env-allowed-flags-are-documented.js

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ const difference = (setA, setB) => {
9393
// Refs: https://github.com/nodejs/node/pull/54259#issuecomment-2308256647
9494
if (!process.features.inspector) {
9595
[
96+
'--cpu-prof-dir',
97+
'--cpu-prof-interval',
98+
'--cpu-prof-name',
99+
'--cpu-prof',
96100
'--heap-prof-dir',
97101
'--heap-prof-interval',
98102
'--heap-prof-name',

0 commit comments

Comments
 (0)