doc: simplify process.resourceUsage() section

Merge options list with its description to reduce redundancy
(some possible typos were also fixed and some periods added).

PR-URL: https://github.com/nodejs/node/pull/28499
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Vse Mozhet Byt 2019-07-01 18:04:44 +03:00 committed by Rich Trott
parent 8619b19a80
commit 344d12c592

View File

@ -1821,60 +1821,48 @@ Additional documentation is available in the [report documentation][].
added: v12.6.0 added: v12.6.0
--> -->
* Returns: {Object} * Returns: {Object} the resource usage for the current process. All of these
* `userCPUTime` {integer} values come from the `uv_getrusage` call which returns
* `systemCPUTime` {integer} a [`uv_rusage_t` struct][uv_rusage_t].
* `maxRSS` {integer} * `userCPUTime` {integer} maps to `ru_utime` computed in microseconds.
* `sharedMemorySize` {integer} It is the same value as [`process.cpuUsage().user`][process.cpuUsage].
* `unsharedDataSize` {integer} * `systemCPUTime` {integer} maps to `ru_stime` computed in microseconds.
* `unsharedStackSize` {integer} It is the same value as [`process.cpuUsage().system`][process.cpuUsage].
* `minorPageFault` {integer} * `maxRSS` {integer} maps to `ru_maxrss` which is the maximum resident set
* `majorPageFault` {integer} size used in kilobytes.
* `swappedOut` {integer} * `sharedMemorySize` {integer} maps to `ru_ixrss` but is not supported by
* `fsRead` {integer} any platform.
* `fsWrite` {integer} * `unsharedDataSize` {integer} maps to `ru_idrss` but is not supported by
* `ipcSent` {integer} any platform.
* `ipcReceived` {integer} * `unsharedStackSize` {integer} maps to `ru_isrss` but is not supported by
* `signalsCount` {integer} any platform.
* `voluntaryContextSwitches` {integer} * `minorPageFault` {integer} maps to `ru_minflt` which is the number of
* `involuntaryContextSwitches` {integer} minor page faults for the process, see
[this article for more details][wikipedia_minor_fault].
The `process.resourceUsage()` method returns the resource usage * `majorPageFault` {integer} maps to `ru_majflt` which is the number of
for the current process. major page faults for the process, see
All of these values come from the `uv_getrusage` call which returns [this article for more details][wikipedia_major_fault]. This field is not
[this struct][uv_rusage_t], here the mapping between node and libuv: supported on Windows.
- `userCPUTime` maps to `ru_utime` computed in microseconds. * `swappedOut` {integer} maps to `ru_nswap` but is not supported by any
It is the values as [`process.cpuUsage().user`][process.cpuUsage] platform.
- `systemCPUTime` maps to `ru_stime` computed in microseconds. * `fsRead` {integer} maps to `ru_inblock` which is the number of times the
It is the value as [`process.cpuUsage().system`][process.cpuUsage] file system had to perform input.
- `maxRSS` maps to `ru_maxrss` which is the maximum resident set size * `fsWrite` {integer} maps to `ru_oublock` which is the number of times the
used (in kilobytes). file system had to perform output.
- `sharedMemorySize` maps to `ru_ixrss` but is not supported by any platform. * `ipcSent` {integer} maps to `ru_msgsnd` but is not supported by any
- `unsharedDataSize` maps to `ru_idrss` but is not supported by any platform. platform.
- `unsharedStackSize` maps to `ru_isrss` but is not supported by any platform. * `ipcReceived` {integer} maps to `ru_msgrcv` but is not supported by any
- `minorPageFault` maps to `ru_minflt` which is the number of minor page fault platform.
for the process, see [this article for more details][wikipedia_minor_fault] * `signalsCount` {integer} maps to `ru_nsignals` but is not supported by any
- `majorPageFault` maps to `ru_majflt` which is the number of major page fault platform.
for the process, see [this article for more details][wikipedia_major_fault]. * `voluntaryContextSwitches` {integer} maps to `ru_nvcsw` which is the
This field is not supported on Windows platforms. number of times a CPU context switch resulted due to a process voluntarily
- `swappedOut` maps to `ru_nswap` which is not supported by any platform. giving up the processor before its time slice was completed (usually to
- `fsRead` maps to `ru_inblock` which is the number of times the file system await availability of a resource). This field is not supported on Windows.
had to perform input. * `involuntaryContextSwitches` {integer} maps to `ru_nivcsw` which is the
- `fsWrite` maps to `ru_oublock` which is the number of times the file system number of times a CPU context switch resulted due to a higher priority
had to perform output. process becoming runnable or because the current process exceeded its
- `ipcSent` maps to `ru_msgsnd` but is not supported by any platform. time slice. This field is not supported on Windows.
- `ipcReceived` maps to `ru_msgrcv` but is not supported by any platform.
- `signalsCount` maps to `ru_nsignals` but is not supported by any platform.
- `voluntaryContextSwitches` maps to `ru_nvcsw` which is the number of times
a CPU context switch resulted due to a process voluntarily giving up the
processor before its time slice was completed
(usually to await availability of a resource).
This field is not supported on Windows platforms.
- `involuntaryContextSwitches` maps to `ru_nivcsw` which is the number of times
a CPU context switch resulted due to a higher priority process becoming runnable
or because the current process exceeded its time slice.
This field is not supported on Windows platforms.
```js ```js
console.log(process.resourceUsage()); console.log(process.resourceUsage());