Skip to content

Commit 58eccb1

Browse files
Trotttargos
authored andcommitted
test: document cpu-prof module
PR-URL: #28183 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 81a1a13 commit 58eccb1

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

test/common/README.md

+42
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This directory contains modules used to test the Node.js implementation.
88
* [Benchmark module](#benchmark-module)
99
* [Common module API](#common-module-api)
1010
* [Countdown module](#countdown-module)
11+
* [CPU Profiler module](#cpu-profiler-module)
1112
* [DNS module](#dns-module)
1213
* [Duplex pair helper](#duplex-pair-helper)
1314
* [Environment variables](#environment-variables)
@@ -431,6 +432,47 @@ Decrements the `Countdown` counter.
431432
Specifies the remaining number of times `Countdown.prototype.dec()` must be
432433
called before the callback is invoked.
433434

435+
## CPU Profiler module
436+
437+
The `cpu-prof` module provides utilities related to CPU profiling tests.
438+
439+
### env
440+
441+
* Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
442+
443+
Environment variables used in profiled processes. FIB will be set to `40` on
444+
Windows and `30` elsewhere.
445+
446+
### getCpuProfiles(dir)
447+
448+
* `dir` {string} The directory containing the CPU profile files.
449+
* return [&lt;string>]
450+
451+
Returns an array of all `.cpuprofile` files found in `dir`.
452+
453+
### getFrames(output, file, suffix)
454+
455+
* `output` Unused.
456+
* `file` {string} Path to a `.cpuprofile` file.
457+
* `suffix` {string} Suffix of the URL of call frames to retrieve.
458+
* returns { frames: [&lt;Object>], nodes: [&lt;Object>] }
459+
460+
Returns an object containing an array of the relevant call frames and an array
461+
of all the profile nodes.
462+
463+
### kCpuProfInterval
464+
465+
Sampling interval in microseconds.
466+
467+
### verifyFrames(output, file, suffix)
468+
469+
* `output` {string}
470+
* `file` {string}
471+
* `suffix` {string}
472+
473+
Throws an `AssertionError` if there are no call frames with the expected
474+
`suffix` in the profiling data contained in `file`.
475+
434476
## DNS Module
435477

436478
The `DNS` module provides utilities related to the `dns` built-in module.

0 commit comments

Comments
 (0)