https://github.com/platformatic/thread-cpu-usage
https://github.com/platformatic/thread-cpu-usage
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/platformatic/thread-cpu-usage
- Owner: platformatic
- License: apache-2.0
- Created: 2024-10-01T15:28:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-09T10:46:48.000Z (over 1 year ago)
- Last Synced: 2025-04-16T21:25:17.661Z (11 months ago)
- Language: JavaScript
- Size: 85.9 KB
- Stars: 5
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# thread-cpu-usage
The package exports a single function: `threadCpuUsage`.
The function method returns the user and system CPU time usage of the current thread, in an object with properties `user` and `system`, whose values are microsecond values (millionth of a second).
The result of a previous call to `threadCpuUsage` can be passed as the argument to the function, to get a diff reading.
The API is purposely designed to be identical to Node.js' [process.cpuUsage([previousValue])](https://nodejs.org/dist/latest/docs/api/process.html#processcpuusagepreviousvalue) API.
## Install
```sh
npm install thread-cpu-usage
```
## License
Apache 2.0