summaryrefslogtreecommitdiff
path: root/src/env.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-04-03 18:05:33 -0700
committerJames M Snell <jasnell@gmail.com>2018-04-17 08:30:20 -0700
commit5c27e44488aa1c00248297204ff3484c24ff3ae7 (patch)
tree4c061d36122bcb91028eb9d0457dfa15bc84604a /src/env.cc
parent95fafc0254f6636b7c7546ac63599c79a7182fd9 (diff)
downloadandroid-node-v8-5c27e44488aa1c00248297204ff3484c24ff3ae7.tar.gz
android-node-v8-5c27e44488aa1c00248297204ff3484c24ff3ae7.tar.bz2
android-node-v8-5c27e44488aa1c00248297204ff3484c24ff3ae7.zip
trace_events: adds a new trace_events api
Removes the requirement to use `--trace-events-enabled` to enable trace events. Tracing is enabled automatically if there are any enabled categories. Adds a new `trace_events` module with an API for enabling/disabling trace events at runtime without a command line flag. ```js const trace_events = require('trace_events'); const categories = [ 'node.perf', 'node.async_hooks' ]; const tracing = trace_events.createTracing({ categories }); tracing.enable(); // do stuff tracing.disable(); ``` Multiple `Tracing` objects may exist and be enabled at any point in time. The enabled trace event categories is the union of all enabled `Tracing` objects and the `--trace-event-categories` flag. PR-URL: https://github.com/nodejs/node/pull/19803 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/env.cc b/src/env.cc
index 4be70036e3..1f47ea21af 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -3,6 +3,7 @@
#include "node_buffer.h"
#include "node_platform.h"
#include "node_file.h"
+#include "tracing/agent.h"
#include <stdio.h>
#include <algorithm>
@@ -87,9 +88,11 @@ void InitThreadLocalOnce() {
}
Environment::Environment(IsolateData* isolate_data,
- Local<Context> context)
+ Local<Context> context,
+ tracing::Agent* tracing_agent)
: isolate_(context->GetIsolate()),
isolate_data_(isolate_data),
+ tracing_agent_(tracing_agent),
immediate_info_(context->GetIsolate()),
tick_info_(context->GetIsolate()),
timer_base_(uv_now(isolate_data->event_loop())),