Skip to content

Commit e26d484

Browse files
Ceres6targos
authored andcommitted
cli: allow --cpu-prof* in NODE_OPTIONS
Fixes: #56944 PR-URL: #57018 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent b384baa commit e26d484

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
@@ -3146,6 +3146,10 @@ one is included in the list below.
31463146
* `--allow-wasi`
31473147
* `--allow-worker`
31483148
* `--conditions`, `-C`
3149+
* `--cpu-prof-dir`
3150+
* `--cpu-prof-interval`
3151+
* `--cpu-prof-name`
3152+
* `--cpu-prof`
31493153
* `--diagnostic-dir`
31503154
* `--disable-proto`
31513155
* `--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)