New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Implement process.getProcessMemoryInfo to get the process memory usage #14847
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
87c2312
feat: Implement process.getMemoryFootprint to get the process memory …
nitsakh f095e04
Add spec
nitsakh a285a63
fix: must enter node env in callback
zcbenz 532a8f8
Update function call
nitsakh 5bf5524
Update spec
nitsakh 38d1d0d
Update API data
nitsakh e0dea4a
update spec
nitsakh 96f5caf
Update include
nitsakh 488b19d
update test for shared bytes
nitsakh f6c3b74
Update atom/common/api/atom_bindings.cc
nornagon 51143f6
Update atom/common/api/atom_bindings.cc
nornagon 62f8e06
Update API
nitsakh 7f78bf4
Update the callback isolate
nitsakh 153b983
Update to work after app ready
nitsakh d2c6c09
Update docs
nitsakh 1a063b7
Update docs/api/process.md
nornagon 0c85253
Update docs/api/process.md
nornagon 077caff
Fix crash
zcbenz File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 |
---|---|---|
|
@@ -38,16 +38,18 @@ describe('process module', () => { | |
}) | ||
}) | ||
|
||
// FIXME: Chromium 67 - getProcessMemoryInfo has been removed | ||
// describe('process.getProcessMemoryInfo()', () => { | ||
// it('returns process memory info object', () => { | ||
// const processMemoryInfo = process.getProcessMemoryInfo() | ||
// expect(processMemoryInfo.peakWorkingSetSize).to.be.a('number') | ||
// expect(processMemoryInfo.privateBytes).to.be.a('number') | ||
// expect(processMemoryInfo.sharedBytes).to.be.a('number') | ||
// expect(processMemoryInfo.workingSetSize).to.be.a('number') | ||
// }) | ||
// }) | ||
describe('process.getProcessMemoryInfo()', async () => { | ||
it('resolves promise successfully with valid data', async () => { | ||
const memoryInfo = await process.getProcessMemoryInfo() | ||
expect(memoryInfo).to.be.an('object') | ||
if (process.platform === 'linux' || process.platform === 'windows') { | ||
expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0) | ||
} | ||
expect(memoryInfo.private).to.be.a('number').greaterThan(0) | ||
// Shared bytes can be zero | ||
expect(memoryInfo.shared).to.be.a('number').greaterThan(-1) | ||
}) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a writeup in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, mainly waiting for reviews on the API itself before writing the documentation. |
||
|
||
describe('process.getSystemMemoryInfo()', () => { | ||
it('returns system memory info object', () => { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure that
clang-format
won't "fix" the order of includes here.Usually leaving an empty line before such an include helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the comment helps, and prevents sorting. But will verify, thanks.