Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

cpu-percent

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpu-percent

use procfs to return % cpu use for the whole system

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
180
-60%
Maintainers
1
Weekly downloads
 
Created
Source

cpu-percent

use procfs to return % cpu use for the whole system


var percent = require('cpu-percent')

percent(function(percent){
  console.log(percent,'%')
})

``

## API

- var stop = module.exports(eventBack,sampleTime,windowSize)
  - eventBack, is a function that is called for each new sample
    - eventBack(Number percent), eventBack is called with one argument. the percent cpu used over the sample size
  - sampleTime, the time in ms to poll for cpu use. default 1000
  - windowSize, the number of samples to average for the percentage. default 5

  - returns a stop function. calling stop() stops the sampling interval.

 

Keywords

cpu

FAQs

Package last updated on 14 Aug 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