process.resourceUsage(): Object
Returns:
Objectthe resource usage for the current process. All of these
values come from the
uv_getrusage call which returns
a uv_rusage_t struct.userCPUTime:
integermaps to
ru_utime computed in microseconds.
It is the same value as process.cpuUsage().user.systemCPUTime:
integermaps to
ru_stime computed in microseconds.
It is the same value as process.cpuUsage().system.maxRSS:
integermaps to
ru_maxrss which is the maximum resident set
size used in kibibytes (1024 bytes).sharedMemorySize:
integermaps to
ru_ixrss but is not supported by
any platform.unsharedDataSize:
integermaps to
ru_idrss but is not supported by
any platform.unsharedStackSize:
integermaps to
ru_isrss but is not supported by
any platform.minorPageFault:
integermaps to
ru_minflt which is the number of
minor page faults for the process, see
this article for more details.majorPageFault:
integermaps to
ru_majflt which is the number of
major page faults for the process, see
this article for more details. This field is not
supported on Windows.swappedOut:
integermaps to
ru_nswap but is not supported by any
platform.fsRead:
integermaps to
ru_inblock which is the number of times the
file system had to perform input.fsWrite:
integermaps to
ru_oublock which is the number of times the
file system had to perform output.ipcSent:
integermaps to
ru_msgsnd but is not supported by any
platform.ipcReceived:
integermaps to
ru_msgrcv but is not supported by any
platform.signalsCount:
integermaps to
ru_nsignals but is not supported by any
platform.voluntaryContextSwitches:
integermaps 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.involuntaryContextSwitches:
integermaps 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.import { resourceUsage } from 'node:process'; console.log(resourceUsage()); /* Will output: { userCPUTime: 82872, systemCPUTime: 4143, maxRSS: 33164, sharedMemorySize: 0, unsharedDataSize: 0, unsharedStackSize: 0, minorPageFault: 2469, majorPageFault: 0, swappedOut: 0, fsRead: 0, fsWrite: 8, ipcSent: 0, ipcReceived: 0, signalsCount: 0, voluntaryContextSwitches: 79, involuntaryContextSwitches: 1 } */
const { resourceUsage } = require('node:process'); console.log(resourceUsage()); /* Will output: { userCPUTime: 82872, systemCPUTime: 4143, maxRSS: 33164, sharedMemorySize: 0, unsharedDataSize: 0, unsharedStackSize: 0, minorPageFault: 2469, majorPageFault: 0, swappedOut: 0, fsRead: 0, fsWrite: 8, ipcSent: 0, ipcReceived: 0, signalsCount: 0, voluntaryContextSwitches: 79, involuntaryContextSwitches: 1 } */