Skip to content

Commit

Permalink
test: add logging to test-worker-memory
Browse files Browse the repository at this point in the history
To help troubleshoot CI failures, add some logging.

Refs: #23277 (comment)

PR-URL: #23418
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Oct 30, 2018
1 parent ffadcc1 commit 27dd4de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/parallel/test-worker-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const numWorkers = +process.env.JOBS || require('os').cpus().length;
// Verify that a Worker's memory isn't kept in memory after the thread finishes.

function run(n, done) {
console.log(`run() called with n=${n} (numWorkers=${numWorkers})`);
if (n <= 0)
return done();
const worker = new Worker(
Expand All @@ -27,6 +28,7 @@ const startStats = process.memoryUsage();
let finished = 0;
for (let i = 0; i < numWorkers; ++i) {
run(60 / numWorkers, () => {
console.log(`done() called (finished=${finished})`);
if (++finished === numWorkers) {
const finishStats = process.memoryUsage();
// A typical value for this ratio would be ~1.15.
Expand Down

0 comments on commit 27dd4de

Please sign in to comment.