diff --git a/test/common/README.md b/test/common/README.md index 1f47baf7a8593f..2b8f852a3b74dd 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -438,10 +438,9 @@ The `cpu-prof` module provides utilities related to CPU profiling tests. ### env -* Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' } +* Default: { ...process.env, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' } -Environment variables used in profiled processes. FIB will be set to `40` on -Windows and `30` elsewhere. +Environment variables used in profiled processes. ### getCpuProfiles(dir) diff --git a/test/common/cpu-prof.js b/test/common/cpu-prof.js index 8e8bd42275b7d8..ae81eefd45c307 100644 --- a/test/common/cpu-prof.js +++ b/test/common/cpu-prof.js @@ -2,7 +2,7 @@ 'use strict'; -const common = require('./'); +require('./'); const fs = require('fs'); const path = require('path'); const assert = require('assert'); @@ -34,23 +34,12 @@ function verifyFrames(output, file, suffix) { assert.notDeepStrictEqual(frames, []); } -let FIB = 30; -// This is based on emperial values - in the CI, on Windows the program -// tend to finish too fast then we won't be able to see the profiled script -// in the samples, so we need to bump the values a bit. On slower platforms -// like the Pis it could take more time to complete, we need to use a -// smaller value so the test would not time out. -if (common.isWindows) { - FIB = 40; -} - // We need to set --cpu-interval to a smaller value to make sure we can // find our workload in the samples. 50us should be a small enough sampling // interval for this. const kCpuProfInterval = 50; const env = { ...process.env, - FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }; diff --git a/test/fixtures/workload/fibonacci.js b/test/fixtures/workload/fibonacci.js index 899006daa5af37..0326914d048203 100644 --- a/test/fixtures/workload/fibonacci.js +++ b/test/fixtures/workload/fibonacci.js @@ -4,5 +4,12 @@ function fib(n) { return fib(n - 1) + fib(n - 2); } -const n = parseInt(process.env.FIB) || 35; +// This is based on emperial values - in the CI, on Windows the program +// tend to finish too fast then we won't be able to see the profiled script +// in the samples, so we need to bump the values a bit. On slower platforms +// like the Pis it could take more time to complete, we need to use a +// smaller value so the test would not time out. +const FIB = process.platform === 'win32' ? 40 : 30; + +const n = parseInt(process.env.FIB) || FIB; process.stdout.write(`${fib(n)}\n`);