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

Function disableCPUProfiler

test/fixtures/snapshot/typescript.js:7145–7179  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

7143 return profile;
7144 }
7145 function disableCPUProfiler(cb) {
7146 if (activeSession && activeSession !== "stopping") {
7147 var s_1 = activeSession;
7148 activeSession.post("Profiler.stop", function (err, _a) {
7149 var _b;
7150 var profile = _a.profile;
7151 if (!err) {
7152 try {
7153 if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) {
7154 profilePath = _path.join(profilePath, "".concat((new Date()).toISOString().replace(/:/g, "-"), "+P").concat(process.pid, ".cpuprofile"));
7155 }
7156 }
7157 catch (_c) {
7158 // do nothing and ignore fallible fs operation
7159 }
7160 try {
7161 _fs.mkdirSync(_path.dirname(profilePath), { recursive: true });
7162 }
7163 catch (_d) {
7164 // do nothing and ignore fallible fs operation
7165 }
7166 _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile)));
7167 }
7168 activeSession = undefined;
7169 s_1.disconnect();
7170 cb();
7171 });
7172 activeSession = "stopping";
7173 return true;
7174 }
7175 else {
7176 cb();
7177 return false;
7178 }
7179 }
7180 function bufferFrom(input, encoding) {
7181 // See https://github.com/Microsoft/TypeScript/issues/25652
7182 return Buffer.from && Buffer.from !== Int8Array.from

Callers 1

getNodeSystemFunction · 0.85

Calls 10

cleanupPathsFunction · 0.85
concatMethod · 0.80
statSyncFunction · 0.70
disconnectMethod · 0.65
cbFunction · 0.50
postMethod · 0.45
isDirectoryMethod · 0.45
joinMethod · 0.45
mkdirSyncMethod · 0.45
writeFileSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…