# cpu-percentage

> Get CPU usage percentage of own process

Latest version **1.0.3** (published 2016-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install cpu-percentage
pnpm add cpu-percentage
yarn add cpu-percentage
bun add cpu-percentage
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2016-11-12 |
| First published | 2016-10-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.1 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | Peter Dotchev |
| Maintainers | dotchev |
| Keywords | cpu, usage, utilization, percent |

## Links

- npm: https://www.npmjs.com/package/cpu-percentage
- Repository: https://github.com/dotchev/cpu-percentage
- Homepage: https://github.com/dotchev/cpu-percentage#readme
- Issues: https://github.com/dotchev/cpu-percentage/issues
- npm.io page: https://npm.io/package/cpu-percentage

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2016-11-12
- 1.0.2 — 2016-10-10
- 1.0.1 — 2016-10-10
- 1.0.0 — 2016-10-10

## README

[![Build Status](https://travis-ci.org/dotchev/cpu-percentage.svg?branch=master)](https://travis-ci.org/dotchev/cpu-percentage)
[![npm](https://img.shields.io/npm/v/cpu-percentage.svg)](https://www.npmjs.com/package/cpu-percentage)


# cpu-percentage
Get CPU usage percentage of own process

* Uses JavaScript only and node API ([process.cpuUsage](https://nodejs.org/api/process.html#process_process_cpuusage_previousvalue)). 
* No native code.
* No external processes.

**Note:** requires node 6.1 or later.

See also [cpu-gauge](https://github.com/dotchev/cpu-gauge).

## Install

```sh
npm install -S cpu-percentage
```

## Usage

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

```js
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 }
```

---
_Source: https://npm.io/package/cpu-percentage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
