File tree Expand file tree Collapse file tree 3 files changed +11
-16
lines changed Open diff view settings
Expand file tree Collapse file tree 3 files changed +11
-16
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -438,10 +438,9 @@ The `cpu-prof` module provides utilities related to CPU profiling tests.
438438
439439### env
440440
441- * Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
441+ * Default: { ...process.env, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
442442
443- Environment variables used in profiled processes. FIB will be set to ` 40 ` on
444- Windows and ` 30 ` elsewhere.
443+ Environment variables used in profiled processes.
445444
446445### getCpuProfiles(dir)
447446
Original file line number Diff line number Diff line change 22
33'use strict' ;
44
5- const common = require ( './' ) ;
5+ require ( './' ) ;
66const fs = require ( 'fs' ) ;
77const path = require ( 'path' ) ;
88const assert = require ( 'assert' ) ;
@@ -34,23 +34,12 @@ function verifyFrames(output, file, suffix) {
3434 assert . notDeepStrictEqual ( frames , [ ] ) ;
3535}
3636
37- let FIB = 30 ;
38- // This is based on emperial values - in the CI, on Windows the program
39- // tend to finish too fast then we won't be able to see the profiled script
40- // in the samples, so we need to bump the values a bit. On slower platforms
41- // like the Pis it could take more time to complete, we need to use a
42- // smaller value so the test would not time out.
43- if ( common . isWindows ) {
44- FIB = 40 ;
45- }
46-
4737// We need to set --cpu-interval to a smaller value to make sure we can
4838// find our workload in the samples. 50us should be a small enough sampling
4939// interval for this.
5040const kCpuProfInterval = 50 ;
5141const env = {
5242 ...process . env ,
53- FIB ,
5443 NODE_DEBUG_NATIVE : 'INSPECTOR_PROFILER'
5544} ;
5645
Original file line number Diff line number Diff line change @@ -4,5 +4,12 @@ function fib(n) {
44 return fib ( n - 1 ) + fib ( n - 2 ) ;
55}
66
7- const n = parseInt ( process . env . FIB ) || 35 ;
7+ // This is based on emperial values - in the CI, on Windows the program
8+ // tend to finish too fast then we won't be able to see the profiled script
9+ // in the samples, so we need to bump the values a bit. On slower platforms
10+ // like the Pis it could take more time to complete, we need to use a
11+ // smaller value so the test would not time out.
12+ const FIB = process . platform === 'win32' ? 40 : 30 ;
13+
14+ const n = parseInt ( process . env . FIB ) || FIB ;
815process . stdout . write ( `${ fib ( n ) } \n` ) ;
You can’t perform that action at this time.
0 commit comments