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

cpu-gauge

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpu-gauge

Simple CPU usage metering for node

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
increased by132.16%
Maintainers
1
Weekly downloads
 
Created
Source

npm Build Status

cpu-gauge

Simple CPU usage metering for node

Wraps process.cpuUsage() in a simple to use interface. No need to multiply and divide to get CPU usage percentage.

Note: requires Node.js 6.1 or later.

Install

npm install --save cpu-gauge

Usage

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

var cpu = gauge.start();
// ...
console.log(cpu.usage().percent);

Note altough node executes JavaScript in a single thread, it uses additional threads for background tasks. So it is possible that CPU goes well above 100%.

API

gauge.start()

Starts metering the CPU usage. Returns a cpu object.

cpu.usage()

Resturns CPU usage of current process since start() invocation. Returned object has the following properties:

  • user - user CPU time in microseconds
  • system - system CPU time in microseconds
  • time - elapsed time in microseconds
  • percent - CPU usage as percent of a logical core, so it could be above 100

Keywords

FAQs

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