From 7cfcf8069bb91240d25f83fa5ab5b7af2da49260 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 2 May 2019 21:10:10 +0800 Subject: [PATCH] inspector: implement --cpu-prof-interval This patch implements --cpu-prof-interval to specify the sampling interval of the CPU profiler started by --cpu-prof from the command line. Also adjust the interval to 100 in test-cpu-prof.js to make the test less flaky - it would fail if the time taken to finish the workload is smaller than the sampling interval, which was more likely on powerful machines when the interval was 1000. PR-URL: https://github.com/nodejs/node/pull/27535 Reviewed-By: Jan Krems Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Rich Trott --- doc/api/cli.md | 10 +++ doc/node.1 | 6 ++ src/env-inl.h | 8 +++ src/env.h | 4 ++ src/inspector_profiler.cc | 6 +- src/node_options.cc | 9 +++ src/node_options.h | 2 + .../workload/fibonacci-worker-argv.js | 6 +- test/sequential/test-cpu-prof.js | 65 ++++++++++++++++++- 9 files changed, 113 insertions(+), 3 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index e819451ee132b4..ee766a28582074 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -107,6 +107,16 @@ added: v12.0.0 Specify the directory where the CPU profiles generated by `--cpu-prof` will be placed. +### `--cpu-prof-interval` + + +> Stability: 1 - Experimental + +Specify the sampling interval in microseconds for the CPU profiles generated +by `--cpu-prof`. The default is 1000 microseconds. + ### `--cpu-prof-name`