Socket
Socket
Sign inDemoInstall

@dynamicaction/cpu-percentage

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

@dynamicaction/cpu-percentage

Get CPU usage percentage of own process


Version published
Maintainers
1
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 13 Dec 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