New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

process-cpu-usage

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

process-cpu-usage

Calc the percentage cpu usage of node process

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 19 Mar 2018

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