(n, statType)
| 9 | }); |
| 10 | |
| 11 | async function run(n, statType) { |
| 12 | const handleMode = statType === 'fstat'; |
| 13 | const arg = handleMode ? await fsPromises.open(__filename, 'r') : __filename; |
| 14 | let remaining = n; |
| 15 | bench.start(); |
| 16 | while (remaining-- > 0) |
| 17 | await (handleMode ? arg.stat() : fsPromises[statType](arg)); |
| 18 | bench.end(n); |
| 19 | |
| 20 | if (typeof arg.close === 'function') |
| 21 | await arg.close(); |
| 22 | } |
| 23 | |
| 24 | function main(conf) { |
| 25 | const n = conf.n >>> 0; |