feat: Implement process.getProcessMemoryInfo to get the process memory usage (#14847)
* feat: Implement process.getMemoryFootprint to get the process memory usage * Add spec * fix: must enter node env in callback * Update function call * Update spec * Update API data * update spec * Update include * update test for shared bytes * Update atom/common/api/atom_bindings.cc Co-Authored-By: nitsakh <nitsakh@icloud.com> * Update atom/common/api/atom_bindings.cc Co-Authored-By: nitsakh <nitsakh@icloud.com> * Update API * Update the callback isolate * Update to work after app ready * Update docs * Update docs/api/process.md Co-Authored-By: nitsakh <nitsakh@icloud.com> * Update docs/api/process.md Co-Authored-By: nitsakh <nitsakh@icloud.com> * Fix crash
This commit is contained in:
parent
f563fc9d5e
commit
9890d1e251
4 changed files with 123 additions and 11 deletions
|
@ -14,6 +14,7 @@ In sandboxed renderers the `process` object contains only a subset of the APIs:
|
|||
- `crash()`
|
||||
- `hang()`
|
||||
- `getHeapStatistics()`
|
||||
- `getProcessMemoryInfo()`
|
||||
- `getSystemMemoryInfo()`
|
||||
- `getCPUUsage()`
|
||||
- `getIOCounters()`
|
||||
|
@ -162,6 +163,27 @@ Returns `Object`:
|
|||
|
||||
Returns an object with V8 heap statistics. Note that all statistics are reported in Kilobytes.
|
||||
|
||||
### `process.getProcessMemoryInfo()`
|
||||
|
||||
Returns `Object`:
|
||||
|
||||
* `residentSet` Integer _Linux_ and _Windows_ - The amount of memory
|
||||
currently pinned to actual physical RAM in Kilobytes.
|
||||
* `private` Integer - The amount of memory not shared by other processes, such as
|
||||
JS heap or HTML content in Kilobytes.
|
||||
* `shared` Integer - The amount of memory shared between processes, typically
|
||||
memory consumed by the Electron code itself in Kilobytes.
|
||||
|
||||
Returns an object giving memory usage statistics about the current process. Note
|
||||
that all statistics are reported in Kilobytes.
|
||||
This api should be called after app ready.
|
||||
|
||||
Chromium does not provide `residentSet` value for macOS. This is because macOS
|
||||
performs in-memory compression of pages that haven't been recently used. As a
|
||||
result the resident set size value is not what one would expect. `private` memory
|
||||
is more representative of the actual pre-compression memory usage of the process
|
||||
on macOS.
|
||||
|
||||
### `process.getSystemMemoryInfo()`
|
||||
|
||||
Returns `Object`:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue