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

Function performLoad

test/parallel/test-process-threadCpuUsage-worker-threads.js:24–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22const FREQUENCIES = [100, 500, 1000];
23
24function performLoad() {
25 const buffer = randomBytes(1e8);
26
27 // Do some work
28 return setInterval(() => {
29 createHash('sha256').update(buffer).end(buffer);
30 }, platformTimeout(workerData?.frequency ?? 100));
31}
32
33function getUsages() {
34 return { process: process.cpuUsage(), thread: process.threadCpuUsage() };

Calls 6

randomBytesFunction · 0.85
createHashFunction · 0.85
platformTimeoutFunction · 0.85
updateMethod · 0.65
setIntervalFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…