Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanmonstar/num_cpus
Get the number of CPUs in Rust
https://github.com/seanmonstar/num_cpus
rust
Last synced: about 2 months ago
JSON representation
Get the number of CPUs in Rust
- Host: GitHub
- URL: https://github.com/seanmonstar/num_cpus
- Owner: seanmonstar
- License: apache-2.0
- Created: 2015-03-17T01:09:24.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-03T00:31:55.000Z (3 months ago)
- Last Synced: 2024-07-19T00:41:22.966Z (2 months ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 96.7 KB
- Stars: 573
- Watchers: 14
- Forks: 87
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# num_cpus
[![crates.io](https://img.shields.io/crates/v/num_cpus.svg)](https://crates.io/crates/num_cpus)
[![CI Status](https://github.com/seanmonstar/num_cpus/actions/workflows/ci.yml/badge.svg)](https://github.com/seanmonstar/num_cpus/actions)- [Documentation](https://docs.rs/num_cpus)
- [CHANGELOG](CHANGELOG.md)Count the number of CPUs on the current machine.
## Usage
Add to Cargo.toml:
```toml
[dependencies]
num_cpus = "1.0"
```In your `main.rs` or `lib.rs`:
```rust
extern crate num_cpus;// count logical cores this process could try to use
let num = num_cpus::get();
```