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 <jan.krems@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
11 lines
252 B
JavaScript
11 lines
252 B
JavaScript
'use strict';
|
|
|
|
const { Worker } = require('worker_threads');
|
|
const path = require('path');
|
|
new Worker(path.join(__dirname, 'fibonacci.js'), {
|
|
execArgv: [
|
|
'--cpu-prof',
|
|
'--cpu-prof-interval',
|
|
process.env.CPU_PROF_INTERVAL || '100'
|
|
]
|
|
});
|