From 4ac2e99f3825f3c0864f98e01a2bd8b1ef6a3ead Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sun, 3 May 2020 00:35:33 +0800 Subject: [PATCH] add num_cpus --- num_cpus/Cargo.lock | 33 +++++++++++++++++++++++++++++++++ num_cpus/Cargo.toml | 10 ++++++++++ num_cpus/src/main.rs | 5 +++++ 3 files changed, 48 insertions(+) create mode 100644 num_cpus/Cargo.lock create mode 100644 num_cpus/Cargo.toml create mode 100644 num_cpus/src/main.rs diff --git a/num_cpus/Cargo.lock b/num_cpus/Cargo.lock new file mode 100644 index 0000000..818c5a9 --- /dev/null +++ b/num_cpus/Cargo.lock @@ -0,0 +1,33 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "hermit-abi" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" + +[[package]] +name = "num_cpus" +version = "0.1.0" +dependencies = [ + "num_cpus 1.13.0", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] diff --git a/num_cpus/Cargo.toml b/num_cpus/Cargo.toml new file mode 100644 index 0000000..354671d --- /dev/null +++ b/num_cpus/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "num_cpus" +version = "0.1.0" +authors = ["Hatter Jiang "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +num_cpus = "1.13.0" diff --git a/num_cpus/src/main.rs b/num_cpus/src/main.rs new file mode 100644 index 0000000..add0dd0 --- /dev/null +++ b/num_cpus/src/main.rs @@ -0,0 +1,5 @@ +fn main() { + + println!("num of cpus: {}", num_cpus::get()); + println!("num of cpus: {}", num_cpus::get_physical()); +}