From bd4ccc892c0413439c3d068485cbfb49ea78b842 Mon Sep 17 00:00:00 2001 From: misterpoe Date: Fri, 5 Aug 2016 14:04:25 -0700 Subject: [PATCH] src: add tracing controller This commit adds support for trace-event tracing to Node.js. It provides a mechanism to centralize tracing information generated by V8, Node core, and userspace code. It includes: - A trace writer responsible for serializing traces and cycling the output files so that no individual file becomes to large. - A buffer for aggregating traces to allow for batched flushes. - An agent which initializes the tracing controller and ensures that trace serialization is done on a separate thread. - A set of macros for generating trace events. - Tests and documentation. Author: Raymond Kang Author: Kelvin Jin Author: Matthew Loring Author: Jason Ginchereau PR-URL: https://github.com/nodejs/node/pull/11106 Reviewed-By: Josh Gavant --- doc/api/cli.md | 14 + doc/api/debugger.md | 2 +- doc/api/tracing.md | 19 + node.gyp | 5 + src/node.cc | 28 + src/node.h | 1 + src/tracing/agent.cc | 72 ++ src/tracing/agent.h | 31 + src/tracing/node_trace_buffer.cc | 177 +++ src/tracing/node_trace_buffer.h | 89 ++ src/tracing/node_trace_writer.cc | 185 ++++ src/tracing/node_trace_writer.h | 74 ++ src/tracing/trace_event.cc | 17 + src/tracing/trace_event.h | 1710 +++++++++++++++++++++++++++++ test/parallel/test-trace-event.js | 35 + 15 files changed, 2458 insertions(+), 1 deletion(-) create mode 100644 doc/api/tracing.md create mode 100644 src/tracing/agent.cc create mode 100644 src/tracing/agent.h create mode 100644 src/tracing/node_trace_buffer.cc create mode 100644 src/tracing/node_trace_buffer.h create mode 100644 src/tracing/node_trace_writer.cc create mode 100644 src/tracing/node_trace_writer.h create mode 100644 src/tracing/trace_event.cc create mode 100644 src/tracing/trace_event.h create mode 100644 test/parallel/test-trace-event.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 720108e1b3e836..5079325d0b90d0 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -139,6 +139,20 @@ added: v2.1.0 Prints a stack trace whenever synchronous I/O is detected after the first turn of the event loop. +### `--trace-events-enabled` + + +Enables the collection of trace event tracing information. + +### `--trace-event-categories` + + +A comma separated list of categories that should be traced when trace event +tracing is enabled using `--trace-events-enabled`. ### `--zero-fill-buffers`