From 58eccb12134022deac3aeef3113e914db84600d6 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 11 Jun 2019 13:54:19 -0700 Subject: [PATCH] test: document cpu-prof module PR-URL: https://github.com/nodejs/node/pull/28183 Reviewed-By: Richard Lau Reviewed-By: James M Snell --- test/common/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/common/README.md b/test/common/README.md index 9c0d150b789a5b..a60a60ce206c89 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -8,6 +8,7 @@ This directory contains modules used to test the Node.js implementation. * [Benchmark module](#benchmark-module) * [Common module API](#common-module-api) * [Countdown module](#countdown-module) +* [CPU Profiler module](#cpu-profiler-module) * [DNS module](#dns-module) * [Duplex pair helper](#duplex-pair-helper) * [Environment variables](#environment-variables) @@ -431,6 +432,47 @@ Decrements the `Countdown` counter. Specifies the remaining number of times `Countdown.prototype.dec()` must be called before the callback is invoked. +## CPU Profiler module + +The `cpu-prof` module provides utilities related to CPU profiling tests. + +### env + +* Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' } + +Environment variables used in profiled processes. FIB will be set to `40` on +Windows and `30` elsewhere. + +### getCpuProfiles(dir) + +* `dir` {string} The directory containing the CPU profile files. +* return [<string>] + +Returns an array of all `.cpuprofile` files found in `dir`. + +### getFrames(output, file, suffix) + +* `output` Unused. +* `file` {string} Path to a `.cpuprofile` file. +* `suffix` {string} Suffix of the URL of call frames to retrieve. +* returns { frames: [<Object>], nodes: [<Object>] } + +Returns an object containing an array of the relevant call frames and an array +of all the profile nodes. + +### kCpuProfInterval + +Sampling interval in microseconds. + +### verifyFrames(output, file, suffix) + +* `output` {string} +* `file` {string} +* `suffix` {string} + +Throws an `AssertionError` if there are no call frames with the expected +`suffix` in the profiling data contained in `file`. + ## DNS Module The `DNS` module provides utilities related to the `dns` built-in module.