GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: harden the tick sampling logic · nodejs/node@a40e7da

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/sequential
    • test-worker-prof.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/sequential/test-worker-prof.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-worker-prof.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const { spawnSync } = require('child_process');
1111
// Refs: https://github.com/nodejs/node/issues/24016
1212

1313
if (process.argv[2] === 'child') {
14+
const fs = require('fs');
1415
let files = fs.readdirSync(tmpdir.path);
1516
const plog = files.filter((name) => /\.log$/.test(name))[0];
1617
if (plog === undefined) {
@@ -19,20 +20,20 @@ if (process.argv[2] === 'child') {
1920
}
2021
const pingpong = `
2122
let counter = 0;
23+
const fs = require('fs');
2224
const { Worker, parentPort } = require('worker_threads');
2325
parentPort.on('message', (m) => {
24-
if (counter++ === 1024)
26+
if (counter++ === 10)
2527
process.exit(0);
2628
parentPort.postMessage(
27-
m.toString().split('').reverse().toString().replace(/,/g, ''));
29+
fs.readFileSync(m.toString()).slice(0, 1024 * 1024));
2830
});
2931
`;
3032

3133
const { Worker } = require('worker_threads');
32-
const data = 'x'.repeat(1024);
3334
const w = new Worker(pingpong, { eval: true });
3435
w.on('message', (m) => {
35-
w.postMessage(m.toString().split('').reverse().toString().replace(/,/g, ''));
36+
w.postMessage(process.execPath);
3637
});
3738

3839
w.on('exit', common.mustCall(() => {
@@ -45,7 +46,7 @@ if (process.argv[2] === 'child') {
4546
}
4647
process.exit(0);
4748
}));
48-
w.postMessage(data);
49+
w.postMessage(process.execPath);
4950
} else {
5051
tmpdir.refresh();
5152
const spawnResult = spawnSync(

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.