-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 <shishugi@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
- 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.