Skip to content

Latest commit

 

History

History

tracing-requires

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Tracing require()s

A new TraceEvents object is created in:

const traceEvents = new TraceEvents();

Before the process exits, the TraceEvents object is destroyed and the trace events are stringified and printed to events.json in:

process.on("beforeExit", () => {
const events = traceEvents.getEvents();
traceEvents.destroy();
writeFileSync("events.json", JSON.stringify(events));
});

The require() calls can be tracked by passing true to trackRequires() like it is being done in:

After running node . and opening http://localhost:3000 in your browser, the generated events.json file can be opened on https://ui.perfetto.dev for visualization: