Function
main
({ asyncHooks, connections, duration })
Source from the content-addressed store, hash-verified
| 8 | }); |
| 9 | |
| 10 | function main({ asyncHooks, connections, duration }) { |
| 11 | if (asyncHooks !== 'none') { |
| 12 | let hooks = { |
| 13 | init() {}, |
| 14 | before() {}, |
| 15 | after() {}, |
| 16 | destroy() {}, |
| 17 | promiseResolve() {}, |
| 18 | }; |
| 19 | if (asyncHooks !== 'all' || asyncHooks !== 'disabled') { |
| 20 | hooks = { |
| 21 | [asyncHooks]: () => {}, |
| 22 | }; |
| 23 | } |
| 24 | const hook = require('async_hooks').createHook(hooks); |
| 25 | if (asyncHooks !== 'disabled') { |
| 26 | hook.enable(); |
| 27 | } |
| 28 | } |
| 29 | const server = require('../fixtures/simple-http-server.js') |
| 30 | .listen(common.PORT) |
| 31 | .on('listening', () => { |
| 32 | const path = '/buffer/4/4/normal/1'; |
| 33 | |
| 34 | bench.http({ |
| 35 | connections, |
| 36 | path, |
| 37 | duration, |
| 38 | }, () => { |
| 39 | server.close(); |
| 40 | }); |
| 41 | }); |
| 42 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…