Skip to content

Node module to get the current CPU usage in percent

Notifications You must be signed in to change notification settings

jdforsythe/cpu-pct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cpu-pct

Node module to get the current CPU usage in percent. This uses the os module and has no outside dependencies.

This function gets the CPU percentage once and does not continue returning values.

Install

$ npm install --save cpu-pct

Usage

const cpu = require('cpu-pct');

const options = {
  interval: 100, // time span to get average percent usage (in milliseconds)
  returnType: "string", // "fraction", "whole", or "string"
  decimals: 2
};

cpu.cpuPercent(options, function(pct) {
  console.log(pct);
});

About

Node module to get the current CPU usage in percent

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages