Skip to content

Commit 344d12c

Browse files
vsemozhetbytTrott
authored andcommitted
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: nodejs#28499 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 8619b19 commit 344d12c

File tree

1 file changed

+42
-54
lines changed

1 file changed

+42
-54
lines changed

doc/api/process.md

Lines changed: 42 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,60 +1821,48 @@ Additional documentation is available in the [report documentation][].
18211821
added: v12.6.0
18221822
-->
18231823

1824-
* Returns: {Object}
1825-
* `userCPUTime` {integer}
1826-
* `systemCPUTime` {integer}
1827-
* `maxRSS` {integer}
1828-
* `sharedMemorySize` {integer}
1829-
* `unsharedDataSize` {integer}
1830-
* `unsharedStackSize` {integer}
1831-
* `minorPageFault` {integer}
1832-
* `majorPageFault` {integer}
1833-
* `swappedOut` {integer}
1834-
* `fsRead` {integer}
1835-
* `fsWrite` {integer}
1836-
* `ipcSent` {integer}
1837-
* `ipcReceived` {integer}
1838-
* `signalsCount` {integer}
1839-
* `voluntaryContextSwitches` {integer}
1840-
* `involuntaryContextSwitches` {integer}
1841-
1842-
The `process.resourceUsage()` method returns the resource usage
1843-
for the current process.
1844-
All of these values come from the `uv_getrusage` call which returns
1845-
[this struct][uv_rusage_t], here the mapping between node and libuv:
1846-
- `userCPUTime` maps to `ru_utime` computed in microseconds.
1847-
It is the values as [`process.cpuUsage().user`][process.cpuUsage]
1848-
- `systemCPUTime` maps to `ru_stime` computed in microseconds.
1849-
It is the value as [`process.cpuUsage().system`][process.cpuUsage]
1850-
- `maxRSS` maps to `ru_maxrss` which is the maximum resident set size
1851-
used (in kilobytes).
1852-
- `sharedMemorySize` maps to `ru_ixrss` but is not supported by any platform.
1853-
- `unsharedDataSize` maps to `ru_idrss` but is not supported by any platform.
1854-
- `unsharedStackSize` maps to `ru_isrss` but is not supported by any platform.
1855-
- `minorPageFault` maps to `ru_minflt` which is the number of minor page fault
1856-
for the process, see [this article for more details][wikipedia_minor_fault]
1857-
- `majorPageFault` maps to `ru_majflt` which is the number of major page fault
1858-
for the process, see [this article for more details][wikipedia_major_fault].
1859-
This field is not supported on Windows platforms.
1860-
- `swappedOut` maps to `ru_nswap` which is not supported by any platform.
1861-
- `fsRead` maps to `ru_inblock` which is the number of times the file system
1862-
had to perform input.
1863-
- `fsWrite` maps to `ru_oublock` which is the number of times the file system
1864-
had to perform output.
1865-
- `ipcSent` maps to `ru_msgsnd` but is not supported by any platform.
1866-
- `ipcReceived` maps to `ru_msgrcv` but is not supported by any platform.
1867-
- `signalsCount` maps to `ru_nsignals` but is not supported by any platform.
1868-
- `voluntaryContextSwitches` maps to `ru_nvcsw` which is the number of times
1869-
a CPU context switch resulted due to a process voluntarily giving up the
1870-
processor before its time slice was completed
1871-
(usually to await availability of a resource).
1872-
This field is not supported on Windows platforms.
1873-
- `involuntaryContextSwitches` maps to `ru_nivcsw` which is the number of times
1874-
a CPU context switch resulted due to a higher priority process becoming runnable
1875-
or because the current process exceeded its time slice.
1876-
This field is not supported on Windows platforms.
1877-
1824+
* Returns: {Object} the resource usage for the current process. All of these
1825+
values come from the `uv_getrusage` call which returns
1826+
a [`uv_rusage_t` struct][uv_rusage_t].
1827+
* `userCPUTime` {integer} maps to `ru_utime` computed in microseconds.
1828+
It is the same value as [`process.cpuUsage().user`][process.cpuUsage].
1829+
* `systemCPUTime` {integer} maps to `ru_stime` computed in microseconds.
1830+
It is the same value as [`process.cpuUsage().system`][process.cpuUsage].
1831+
* `maxRSS` {integer} maps to `ru_maxrss` which is the maximum resident set
1832+
size used in kilobytes.
1833+
* `sharedMemorySize` {integer} maps to `ru_ixrss` but is not supported by
1834+
any platform.
1835+
* `unsharedDataSize` {integer} maps to `ru_idrss` but is not supported by
1836+
any platform.
1837+
* `unsharedStackSize` {integer} maps to `ru_isrss` but is not supported by
1838+
any platform.
1839+
* `minorPageFault` {integer} maps to `ru_minflt` which is the number of
1840+
minor page faults for the process, see
1841+
[this article for more details][wikipedia_minor_fault].
1842+
* `majorPageFault` {integer} maps to `ru_majflt` which is the number of
1843+
major page faults for the process, see
1844+
[this article for more details][wikipedia_major_fault]. This field is not
1845+
supported on Windows.
1846+
* `swappedOut` {integer} maps to `ru_nswap` but is not supported by any
1847+
platform.
1848+
* `fsRead` {integer} maps to `ru_inblock` which is the number of times the
1849+
file system had to perform input.
1850+
* `fsWrite` {integer} maps to `ru_oublock` which is the number of times the
1851+
file system had to perform output.
1852+
* `ipcSent` {integer} maps to `ru_msgsnd` but is not supported by any
1853+
platform.
1854+
* `ipcReceived` {integer} maps to `ru_msgrcv` but is not supported by any
1855+
platform.
1856+
* `signalsCount` {integer} maps to `ru_nsignals` but is not supported by any
1857+
platform.
1858+
* `voluntaryContextSwitches` {integer} maps to `ru_nvcsw` which is the
1859+
number of times a CPU context switch resulted due to a process voluntarily
1860+
giving up the processor before its time slice was completed (usually to
1861+
await availability of a resource). This field is not supported on Windows.
1862+
* `involuntaryContextSwitches` {integer} maps to `ru_nivcsw` which is the
1863+
number of times a CPU context switch resulted due to a higher priority
1864+
process becoming runnable or because the current process exceeded its
1865+
time slice. This field is not supported on Windows.
18781866

18791867
```js
18801868
console.log(process.resourceUsage());

0 commit comments

Comments
 (0)