Socket
Socket
Sign inDemoInstall

proc-stats

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

proc-stats

gets usage stats for a process


Version published
Weekly downloads
1.9K
increased by70.82%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

proc-stats

library for getting memory and cpu usage for windows, mac or linux - other os's are not supported. No production dependancies or compilation needed :)

look at the unit tests to see how it is used. remember - you can pull out basic process memory stuff (rss, heapTotal, heapUsed) using process.memoryUsage() - this gives you the % CPU usage per process, and if you are using linux the vsize

usage:

npm install proc-stats


var procStats = require('proc-stats');

procStats.stats(function(e, result){
	/*
	  linux:
	  result looks like:
	  { 
	  	memory: 25751552, // resident set size
	  	memoryInfo: 
	  		{ rss: 25751552, // resident set size
	  		  vsize: 3123171328,//virtual set size
	  		  heapTotal: 16486912, 
  			  heapUsed: 9636688 
  			}, 
	  	cpu: 1.6 
	  } //CPU USAGE

	  windows:
	  result looks same, but no vsize 
	  { 
	  	memory: 25751552, // resident set size
	  	memoryInfo: 
	  		{ rss: 25751552, // resident set size
	  		  heapTotal: 16486912, 
  			  heapUsed: 9636688 
  			}, 
	  	cpu: 1.6 
	  } //CPU USAGE
	*/
});

thanks to Kyll Ross for the windows stuff, https://github.com/KyleRoss/windows-cpu - NB though, I have been testing, and the CPU time always seems to be returningzero - I suspect my unit test isnt generating enough load on windows, dont have time right now to investigate further...

FAQs

Last updated on 24 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc