MCPcopy Index your code
hub / github.com/nodejs/node / enableCPUProfiler

Function enableCPUProfiler

test/fixtures/snapshot/typescript.js:7099–7119  ·  view source on GitHub ↗

* Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details

(path, cb)

Source from the content-addressed store, hash-verified

7097 * See https://nodejs.org/api/inspector.html#inspector_example_usage for details
7098 */
7099 function enableCPUProfiler(path, cb) {
7100 if (activeSession) {
7101 cb();
7102 return false;
7103 }
7104 var inspector = require("inspector");
7105 if (!inspector || !inspector.Session) {
7106 cb();
7107 return false;
7108 }
7109 var session = new inspector.Session();
7110 session.connect();
7111 session.post("Profiler.enable", function () {
7112 session.post("Profiler.start", function () {
7113 activeSession = session;
7114 profilePath = path;
7115 cb();
7116 });
7117 });
7118 return true;
7119 }
7120 /**
7121 * Strips non-TS paths from the profile, so users with private projects shouldn't
7122 * need to worry about leaking paths by submitting a cpu profile to us

Callers

nothing calls this directly

Calls 4

connectMethod · 0.95
postMethod · 0.95
cbFunction · 0.50
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…