From ba4847e879424ad173289e8fb96cc86a09ee899b Mon Sep 17 00:00:00 2001 From: misterpoe Date: Fri, 5 Aug 2016 14:04:25 -0700 Subject: [PATCH] src: Node 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/9304 Reviewed-By: Trevor Norris Reviewed-By: Michael Dawson 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 | 112 +- 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, 2503 insertions(+), 40 deletions(-) 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 d868d70533f5f2..2000c2b3334b74 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -129,6 +129,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`