Skip to content

Commit 1ee5f84

Browse files
Ceres6RafaelGSS
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 d857ae0 commit 1ee5f84

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
@@ -3174,6 +3174,10 @@ one is included in the list below.
31743174
* `--allow-wasi`
31753175
* `--allow-worker`
31763176
* `--conditions`, `-C`
3177+
* `--cpu-prof-dir`
3178+
* `--cpu-prof-interval`
3179+
* `--cpu-prof-name`
3180+
* `--cpu-prof`
31773181
* `--diagnostic-dir`
31783182
* `--disable-proto`
31793183
* `--disable-sigusr1`

src/node_options.cc

+8-4
Original file line numberDiff line numberDiff line change
@@ -625,19 +625,23 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
625625
"Start the V8 CPU profiler on start up, and write the CPU profile "
626626
"to disk before exit. If --cpu-prof-dir is not specified, write "
627627
"the profile to the current working directory.",
628-
&EnvironmentOptions::cpu_prof);
628+
&EnvironmentOptions::cpu_prof,
629+
kAllowedInEnvvar);
629630
AddOption("--cpu-prof-name",
630631
"specified file name of the V8 CPU profile generated with "
631632
"--cpu-prof",
632-
&EnvironmentOptions::cpu_prof_name);
633+
&EnvironmentOptions::cpu_prof_name,
634+
kAllowedInEnvvar);
633635
AddOption("--cpu-prof-interval",
634636
"specified sampling interval in microseconds for the V8 CPU "
635637
"profile generated with --cpu-prof. (default: 1000)",
636-
&EnvironmentOptions::cpu_prof_interval);
638+
&EnvironmentOptions::cpu_prof_interval,
639+
kAllowedInEnvvar);
637640
AddOption("--cpu-prof-dir",
638641
"Directory where the V8 profiles generated by --cpu-prof will be "
639642
"placed. Does not affect --prof.",
640-
&EnvironmentOptions::cpu_prof_dir);
643+
&EnvironmentOptions::cpu_prof_dir,
644+
kAllowedInEnvvar);
641645
AddOption("--experimental-network-inspection",
642646
"experimental network inspection support",
643647
&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)