-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
worker: add ability to take heap snapshot from parent thread
PR-URL: #31569 Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
6fe8eda
commit 8d3ffbe
Showing
17 changed files
with
235 additions
and
77 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,41 @@ | ||
'use strict'; | ||
const { | ||
Symbol | ||
} = primordials; | ||
const { | ||
kUpdateTimer, | ||
onStreamRead, | ||
} = require('internal/stream_base_commons'); | ||
const { owner_symbol } = require('internal/async_hooks').symbols; | ||
const { Readable } = require('stream'); | ||
|
||
const kHandle = Symbol('kHandle'); | ||
|
||
class HeapSnapshotStream extends Readable { | ||
constructor(handle) { | ||
super({ autoDestroy: true }); | ||
this[kHandle] = handle; | ||
handle[owner_symbol] = this; | ||
handle.onread = onStreamRead; | ||
} | ||
|
||
_read() { | ||
if (this[kHandle]) | ||
this[kHandle].readStart(); | ||
} | ||
|
||
_destroy() { | ||
// Release the references on the handle so that | ||
// it can be garbage collected. | ||
this[kHandle][owner_symbol] = undefined; | ||
this[kHandle] = undefined; | ||
} | ||
|
||
[kUpdateTimer]() { | ||
// Does nothing | ||
} | ||
} | ||
|
||
module.exports = { | ||
HeapSnapshotStream | ||
}; |
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
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
Oops, something went wrong.