Socket
Book a DemoInstallSign in
Socket

cpu-pct

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpu-pct

Get the current CPU percentage

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

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);
});

Keywords

cpu

FAQs

Package last updated on 09 Jul 2016

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