MCPcopy Index your code
hub / github.com/nodejs/node / main

Function main

benchmark/async_hooks/http-server.js:10–42  ·  view source on GitHub ↗
({ asyncHooks, connections, duration })

Source from the content-addressed store, hash-verified

8});
9
10function 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

Calls 7

createHookMethod · 0.80
listenMethod · 0.80
httpMethod · 0.80
closeMethod · 0.65
requireFunction · 0.50
enableMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…