pidusage / 0.1.0 last updated 3 months ago created on May 8th 2014
Install
npm install --save pidusage
Clone
git clone git@github.com:soyuka/pidusage.git
dependencies
No dependencies listed.
maintainers
versions
8 total
| 0.1.0 | 3 months ago | soyuka |
| 0.0.7 | 3 months ago | soyuka |
| 0.0.6 | 5 months ago | soyuka |
| 0.0.5 | 5 months ago | soyuka |
| 0.0.4 | 6 months ago | soyuka |
| 0.0.3 | 6 months ago | soyuka |
| 0.0.2 | 6 months ago | soyuka |
| 0.0.1 | 6 months ago | soyuka |
readme
pidusage
Process cpu % and memory use of a PID
Ideas from https://github.com/arunoda/node-usage/ but with no C-bindings
API
What do this script do?
A check on the os.platform is done to determine the method to use.
Linux
We use /proc/{pid}/stat in addition to the the PAGE_SIZE and the CLK_TCK direclty from getconf() command. Uptime comes from proc/uptime file because it's more accurate than the nodejs os.uptime().
On darwin, freebsd, solaris (tested on 10/11)
We use a fallback with the ps -o pcpu,rss -p PID command to get the same informations.
On AIX
AIX is tricky because I have no AIX test environement, at the moment we use: ps -o pcpu,rssize -p PID but /proc results should be more accurate! If you're familiar with the AIX environment and now how to get the same results as we've got with Linux systems, please help.
#4
Windows
Windows is really tricky, atm it uses the wmic.exe, feel free to share ideas on how to improve this.
Licence
MIT