From e0e308448240260c207958dfc3dd9245d903af85 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sat, 23 Mar 2019 07:39:52 +0800 Subject: inspector: implement --cpu-prof[-path] This patch introduces a CLI flag --cpu-prof that starts the V8 CPU profiler on start up, and ends the profiler then writes the CPU profile before the Node.js instance (on the main thread or the worker thread) exits. By default the profile is written to `${cwd}/CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`. The patch also introduces a --cpu-prof-path flag for the user to specify the path the profile will be written to. Refs: https://github.com/nodejs/node/issues/26878 PR-URL: https://github.com/nodejs/node/pull/27147 Reviewed-By: Anna Henningsen --- doc/node.1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'doc/node.1') diff --git a/doc/node.1 b/doc/node.1 index 3de9a5748c..8387b6282a 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -78,6 +78,18 @@ Aborting instead of exiting causes a core file to be generated for analysis. .It Fl -completion-bash Print source-able bash completion script for Node.js. . +.It Fl -cpu-prof +Start the V8 CPU profiler on start up, and write the CPU profile to disk +before exit. If +.Fl -cpu-prof-path +is not specified, the profile will be written to the current working directory. +. +.It Fl -cpu-prof-path +Path the V8 CPU profile generated with +.Fl -cpu-prof +will be written to. When used alone, it implies +.Fl -cpu-prof +. .It Fl -diagnostic-report-directory Location at which the .Sy diagnostic report -- cgit v1.2.3