Skip to content

sonnyp/proctor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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). Percent values report average over time (since process started).

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

About

Node.js module to lookup CPU and memory usage of a process.

Resources

License

Stars

Watchers

Forks

Packages

No packages published