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

Function main

benchmark/async_hooks/gc-tracking.js:25–52  ·  view source on GitHub ↗
({ n, method })

Source from the content-addressed store, hash-verified

23}
24
25function main({ n, method }) {
26 switch (method) {
27 case 'trackingEnabled':
28 bench.start();
29 for (let i = 0; i < n; i++) {
30 new AsyncResource('foobar');
31 }
32 endAfterGC(n);
33 break;
34 case 'trackingEnabledWithDestroyHook':
35 createHook({ destroy: () => {} }).enable();
36 bench.start();
37 for (let i = 0; i < n; i++) {
38 new AsyncResource('foobar');
39 }
40 endAfterGC(n);
41 break;
42 case 'trackingDisabled':
43 bench.start();
44 for (let i = 0; i < n; i++) {
45 new AsyncResource('foobar', { requireManualDestroy: true });
46 }
47 endAfterGC(n);
48 break;
49 default:
50 throw new Error(`Unsupported method "${method}"`);
51 }
52}

Callers

nothing calls this directly

Calls 4

endAfterGCFunction · 0.85
createHookFunction · 0.50
startMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…