diff options
author | James M Snell <jasnell@gmail.com> | 2018-04-03 18:05:33 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-04-17 08:30:20 -0700 |
commit | 5c27e44488aa1c00248297204ff3484c24ff3ae7 (patch) | |
tree | 4c061d36122bcb91028eb9d0457dfa15bc84604a /test/common/index.js | |
parent | 95fafc0254f6636b7c7546ac63599c79a7182fd9 (diff) | |
download | android-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 'test/common/index.js')
-rw-r--r-- | test/common/index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/common/index.js b/test/common/index.js index eaae0b53ac..7df3907f0e 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -30,6 +30,7 @@ const { exec, execSync, spawn, spawnSync } = require('child_process'); const stream = require('stream'); const util = require('util'); const Timer = process.binding('timer_wrap').Timer; +const { hasTracing } = process.binding('config'); const { fixturesDir } = require('./fixtures'); const tmpdir = require('./tmpdir'); @@ -201,6 +202,12 @@ Object.defineProperty(exports, 'hasCrypto', { } }); +Object.defineProperty(exports, 'hasTracing', { + get: function() { + return Boolean(hasTracing); + } +}); + Object.defineProperty(exports, 'hasFipsCrypto', { get: function() { return exports.hasCrypto && require('crypto').fips; |