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: 2 days 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-06-16T12:58:48.000Z (6 days ago)
- Last Synced: 2024-06-18T14:06:45.399Z (4 days ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 96.7 KB
- Stars: 566
- Watchers: 14
- Forks: 86
- Open Issues: 31
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Lists
- awesome-stars - num_cpus
- awesome-stars - seanmonstar/num_cpus - Get the number of CPUs in Rust (Rust)
- awesome-stars - seanmonstar/num_cpus - Get the number of CPUs in Rust (Rust)
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();
```