{ "source": "doc/api/tracing.md", "modules": [ { "textRaw": "Tracing", "name": "tracing", "introduced_in": "v7.7.0", "desc": "

Trace Event provides a mechanism to centralize tracing information generated by\nV8, Node core, and userspace code.

\n

Tracing can be enabled by passing the --trace-events-enabled flag when \nstarting a Node.js application.

\n

The set of categories for which traces are recorded can be specified using the\n--trace-event-categories flag followed by a list of comma separated category \nnames. By default the node, node.async_hooks, and v8 categories are \nenabled.

\n
node --trace-events-enabled --trace-event-categories v8,node,node.async_hooks server.js\n
\n

Running Node.js with tracing enabled will produce log files that can be opened\nin the chrome://tracing\ntab of Chrome.

\n

The logging file is by default called node_trace.${rotation}.log, where\n${rotation} is an incrementing log-rotation id. The filepath pattern can\nbe specified with --trace-event-file-pattern that accepts a template\nstring that supports ${rotation} and ${pid}. For example:

\n
node --trace-events-enabled --trace-event-file-pattern '${pid}-${rotation}.log' server.js\n
\n

Starting with Node 10.0.0, the tracing system uses the same time source as the\none used by process.hrtime() however the trace-event timestamps are expressed\nin microseconds, unlike process.hrtime() which returns nanoseconds.

\n", "type": "module", "displayName": "Tracing" } ] }