process-cpu-usage

0.1.2 • Public • Published

node-process-cpu-usage

Aim

Get % CPU usage of current node process.

Usage

const ProcessCPULoad = require('process-cpu-usage').ProcessCPULoad;
 
const tracker = new ProcessCPULoad();
 
tracker.start((total, user, system) => {
  console.log('CPU Usage: Total: %d, User: %d, System: %d', total, user, system);
});

Have a try

# start example server 
cd bash
$ ./benchmark-server.sh
 
# start wrk benchmark client 
$ ./benchmark-client.sh
 
# see the console output of script benchmark-server.sh 
 
# and use read-load-by-ps.sh to see the CPU usage from linux ps command 
$ ./read-load-by-ps.sh

Readme

Keywords

none

Package Sidebar

Install

npm i process-cpu-usage

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

15.5 kB

Total Files

13

Last publish

Collaborators

  • agreatfool