Merge pull request #9486 from electron/child-observer

Adding CPU & Memory metrics for App
This commit is contained in:
Kevin Sawicki 2017-05-26 09:28:22 -07:00 committed by GitHub
commit 9137a2279a
9 changed files with 186 additions and 36 deletions

View file

@ -127,7 +127,7 @@ Returns:
Emitted when the application is activated. Various actions can trigger
this event, such as launching the application for the first time, attempting
to re-launch the application when it's already running, or clicking on the
to re-launch the application when it's already running, or clicking on the
application's dock or taskbar icon.
### Event: 'continue-activity' _macOS_
@ -762,9 +762,14 @@ Disables hardware acceleration for current app.
This method can only be called before app is ready.
### `app.getAppMemoryInfo()`
### `app.getAppMemoryInfo()` _Deprecated_
Returns [ProcessMemoryInfo[]](structures/process-memory-info.md): Array of `ProcessMemoryInfo` objects that correspond to memory usage statistics of all the processes associated with the app.
Returns [ProcessMetric[]](structures/process-metric.md): Array of `ProcessMetric` objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
**Note:** This method is deprecated, use `app.getAppMetrics()` instead.
### `app.getAppMetrics()`
Returns [ProcessMetric[]](structures/process-metric.md): Array of `ProcessMetric` objects that correspond to memory and cpu usage statistics of all the processes associated with the app.
### `app.setBadgeCount(count)` _Linux_ _macOS_

View file

@ -1,4 +0,0 @@
# ProcessMemoryInfo Object
* `pid` Integer - Process id of the process.
* `memory` [MemoryInfo](memory-info.md) - Memory information of the process.

View file

@ -0,0 +1,6 @@
# ProcessMetric Object
* `pid` Integer - Process id of the process.
* `type` String - Process type (Browser or Tab or GPU etc).
* `memory` [MemoryInfo](memory-info.md) - Memory information for the process.
* `cpu` [CPUUsage](cpu-usage.md) - CPU usage of the process.

View file

@ -5,6 +5,15 @@ The following list includes the APIs that will be removed in Electron 2.0.
There is no timetable for when this release will occur but deprecation
warnings will be added at least 90 days beforehand.
## `app`
```js
// Deprecated
app.getAppMemoryInfo()
// Replace with
app.getAppMetrics()
```
## `BrowserWindow`
```js