node/test/fixtures/workload/fibonacci-exit.js
Joyee Cheung e0e3084482
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 <anna@addaleax.net>
2019-04-19 15:38:23 +08:00

8 lines
160 B
JavaScript

'use strict';
function fib(n) {
if (n === 0 || n === 1) return n;
return fib(n - 1) + fib(n - 2);
}
fib(parseInt(process.argv[2]) || 35);
process.exit(55);