inspector: track async stacks when necessary

With this change, we do async stack tracking only when explicitly
requested by the inspector client. This avoids unnecessary overhead
for clients that might not be interested in async stack traces.

PR-URL: https://github.com/nodejs/node/pull/16308
Fixes: https://github.com/nodejs/node/issues/16180
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
Ali Ijaz Sheikh 2017-10-18 16:00:03 -07:00
parent c087502758
commit 5886e204f0
6 changed files with 142 additions and 69 deletions

View file

@ -55,10 +55,4 @@ function disable() {
exports.setup = function() {
inspector.registerAsyncHook(enable, disable);
if (inspector.isEnabled()) {
// If the inspector was already enabled via --inspect or --inspect-brk,
// the we need to enable the async hook immediately at startup.
enable();
}
};