Last active
April 3, 2019 16:03
-
-
Save addaleax/e7d6db099ae194a3f56e473c9d4c49a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const fs = require('fs').promises; | |
const child_process = require('child_process'); | |
const kPIDSpace = 100000; | |
const kSetupParallelism = 100; | |
async function createUnwritableFile(filename) { | |
try { | |
await fs.unlink(filename); | |
} catch {} | |
// Mode 0 means no access at all. | |
await fs.writeFile(filename, '', { mode: 0 }); | |
} | |
(async function() { | |
// Saturate /tmp with unwritable files of the name format /tmp/perf-${pid}.map | |
for (let i = 0; i < kPIDSpace; i += kSetupParallelism) { | |
const filePromises = []; | |
for (let j = i; j < i + kSetupParallelism; j++) { | |
const filename = `/tmp/perf-${j}.map`; | |
filePromises.push(createUnwritableFile(filename)); | |
} | |
await Promise.all(filePromises); | |
} | |
child_process.execFileSync(process.execPath, ['--perf-basic-prof', '-e', '']); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment