test: remove FIB environment variable from cpu-prof.js

PR-URL: https://github.com/nodejs/node/pull/28183
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott
2019-06-11 16:08:53 -07:00
parent 4928c2f3b1
commit d4c7487840
3 changed files with 11 additions and 16 deletions

View File

@@ -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)

View File

@@ -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'
};

View File

@@ -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`);