diff options
author | Andreas Madsen <amwebdk@gmail.com> | 2017-07-17 16:47:12 -0700 |
---|---|---|
committer | Andreas Madsen <amwebdk@gmail.com> | 2017-11-16 11:46:54 +0100 |
commit | d217b2850efb9005819d55b697a37cbe5bd0003c (patch) | |
tree | 58177a7aa0d00ece9133ac6c2120e2adb940f527 /test/parallel/test-trace-events-category-used.js | |
parent | ed0327b8868cc3df981f81be6409586b97d06ac8 (diff) | |
download | android-node-v8-d217b2850efb9005819d55b697a37cbe5bd0003c.tar.gz android-node-v8-d217b2850efb9005819d55b697a37cbe5bd0003c.tar.bz2 android-node-v8-d217b2850efb9005819d55b697a37cbe5bd0003c.zip |
async_hooks: add trace events to async_hooks
This will allow trace event to record timing information for all
asynchronous operations that are observed by async_hooks.
PR-URL: https://github.com/nodejs/node/pull/15538
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel/test-trace-events-category-used.js')
-rw-r--r-- | test/parallel/test-trace-events-category-used.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/parallel/test-trace-events-category-used.js b/test/parallel/test-trace-events-category-used.js new file mode 100644 index 0000000000..39d09ad862 --- /dev/null +++ b/test/parallel/test-trace-events-category-used.js @@ -0,0 +1,35 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +const CODE = `console.log( + process.binding("trace_events").categoryGroupEnabled("custom") +);`; + +common.refreshTmpDir(); +process.chdir(common.tmpDir); + +const procEnabled = cp.spawn( + process.execPath, + [ '--trace-events-enabled', '--trace-event-categories', 'custom', '-e', CODE ] +); +let procEnabledOutput = ''; + +procEnabled.stdout.on('data', (data) => procEnabledOutput += data); +procEnabled.stderr.pipe(process.stderr); +procEnabled.once('exit', common.mustCall(() => { + assert.strictEqual(procEnabledOutput, 'true\n'); +})); + +const procDisabled = cp.spawn( + process.execPath, + [ '--trace-events-enabled', '--trace-event-categories', 'other', '-e', CODE ] +); +let procDisabledOutput = ''; + +procDisabled.stdout.on('data', (data) => procDisabledOutput += data); +procDisabled.stderr.pipe(process.stderr); +procDisabled.once('exit', common.mustCall(() => { + assert.strictEqual(procDisabledOutput, 'false\n'); +})); |