rusage2
Version:
A binding around libuv's uv_getrusage/ getrusage(2)
68 lines (50 loc) • 1.32 kB
Markdown
# About
This package provides a wrapper around libuv's
[rusage](http://docs.libuv.org/en/v1.x/misc.html?highlight=rusage#c.uv_getrusage) implementation.
# Install
Install with npm:
`npm install --save rusage2`
# Usage
Call `require('rusage2').rusage()` to the an object with the different properties.
## Provided properties
If you call this function, it returns an object that holds the following properties:
```
{ userCpuTimeUsedSec: 0,
userCpuTimeUsedMs: 159729,
systemCpuTimeUsedSec: 0,
systemCpuTimeUsedMs: 30597,
maxRss: 20426752,
sharedMemSize: 0,
unsharedDataSize: 0,
integralUnsharedStackSize: 0,
pageReclaims: 3002,
pageFaults: 2250,
swaps: 0,
blockInputOps: 0,
blockOutputOps: 0,
ipcMsgSent: 55,
ipcMsgReceived: 54,
signalsReceived: 0,
voluntaryContextSwitches: 92,
involuntaryContextSwitches: 374 }
```
## Windows disclaimer
Windows only provides the following resource usage measures - all others are filled with zero:
- userCpuTimeUsedSec
- userCpuTimeUsedMs
- systemCpuTimeUsedSec
- systemCpuTimeUsedMs
# Build Requirements
- node-gyp (install it with `npm install -g node-gyp`)
# Build
```
node-gyp configure
node-gyp build
npm install
node main.js
```
# Run the tests
`npm run test`
(Build the addon first)
# License
MIT 2016 - Roman Klauke (see LICENSE.md)