-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With this change, the V8 profiler will attribute any time between prepare and check cycles, except any entrances to InternalCallbackScope, to be "idle" time. All callbacks, microtasks, and timers will be marked as not idle. The one exception is native modules which don't use the MakeCallback helper, but those are already broken anyway for async context tracking so we should just encourage broken modules to be fixed. PR-URL: #37868 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
const assert = require('assert'); | ||
const { Session } = require('inspector'); | ||
const { promisify } = require('util'); | ||
|
||
const sleep = promisify(setTimeout); | ||
|
||
async function test() { | ||
const inspector = new Session(); | ||
inspector.connect(); | ||
|
||
inspector.post('Profiler.enable'); | ||
inspector.post('Profiler.start'); | ||
|
||
await sleep(1000); | ||
|
||
const { profile } = await new Promise((resolve, reject) => { | ||
inspector.post('Profiler.stop', (err, params) => { | ||
if (err) return reject(err); | ||
resolve(params); | ||
}); | ||
}); | ||
|
||
let hasIdle = false; | ||
for (const node of profile.nodes) { | ||
if (node.callFrame.functionName === '(idle)') { | ||
hasIdle = true; | ||
break; | ||
} | ||
} | ||
assert(hasIdle); | ||
|
||
inspector.post('Profiler.disable'); | ||
inspector.disconnect(); | ||
} | ||
|
||
test().then(common.mustCall(() => { | ||
console.log('Done!'); | ||
})); |