({ dur, len })
| 18 | }); |
| 19 | |
| 20 | function main({ dur, len }) { |
| 21 | bench.start(); |
| 22 | |
| 23 | const msg = `"${'.'.repeat(len)}"`; |
| 24 | const options = { 'stdio': ['ignore', 'pipe', 'ignore'] }; |
| 25 | const child = child_process.spawn('yes', [msg], options); |
| 26 | |
| 27 | let bytes = 0; |
| 28 | child.stdout.on('data', (msg) => { |
| 29 | bytes += msg.length; |
| 30 | }); |
| 31 | |
| 32 | setTimeout(() => { |
| 33 | if (process.platform === 'win32') { |
| 34 | // Sometimes there's a yes.exe process left hanging around on Windows... |
| 35 | child_process.execSync(`taskkill /f /t /pid ${child.pid}`); |
| 36 | } else { |
| 37 | child.kill(); |
| 38 | } |
| 39 | const gbits = (bytes * 8) / (1024 * 1024 * 1024); |
| 40 | bench.end(gbits); |
| 41 | }, dur * 1000); |
| 42 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…