process-doctor

1.0.0 • Public • Published

proctor

Node.js CPU and memory usage lookup for a process.

build status js-standard-style

npm install process-doctor

Supports Linux (via /proc) and OS X (via ps). Reports current usage, not average.

Usage

var proctor = require('process-doctor')
 
proctor.CLK_TCK // number, clocks per tick (used to calculate % CPU)
 
// PID {Number} is optional and defaults to process.pid
proctor.lookup(PID, function(err, result) {
  console.log(err || result)
})
{
  "time": 60, // total time (= utime + stime)
  "utime": 48, // time spent in user space
  "stime": 12, // time spent in kernel space
  "etime": 100, // time elapsed since process started
  "ptime": 0.6, // CPU % of time (= putime + pstime)
  "putime": 0.48, // CPU % of utime
  "pstime": 0.12 // CPU % of stime
}

Test

npm install -g standard
npm test

Package Sidebar

Install

npm i process-doctor

Weekly Downloads

591

Version

1.0.0

License

ISC

Last publish

Collaborators

  • sonny