Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cpu-percentage

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

cpu-percentage

Get CPU usage percentage of own process

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
586
decreased by-12.28%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status npm

cpu-percentage

Get CPU usage percentage of own process

  • Uses JavaScript only and node API (process.cpuUsage).
  • No native code.
  • No external processes.

Note: requires node 6.1 or later.

See also cpu-gauge.

Install

npm install -S cpu-percentage

Usage

In this example we measure the CPU usage while loading a text file.

var usage = require('cpu-percentage');
var fs = require('fs');

var start = usage();
fs.readFile(__filename, 'utf8', function(err, data) {
  console.log(usage(start));
});

The result is similar to

{ user: 8000, system: 4000, time: 9, percent: 133.33333333333334 }

Keywords

FAQs

Package last updated on 12 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc