diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2024-02-02 13:39:43 +0100 |
---|---|---|
committer | Jeff Vander Stoep <jeffv@google.com> | 2024-02-05 09:42:03 +0100 |
commit | 68cc60498ac74239ed09ebff4ddeb237da8bd84f (patch) | |
tree | 708018eaf284a2260f946ebf77c97254945d6761 | |
parent | d41ac629adce558dfe1e0c01287b800938287eab (diff) | |
download | num_cpus-emu-34-3-release.tar.gz |
Upgrade num_cpus to 1.16.0emu-34-3-release
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update external/rust/crates/num_cpus
For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I9f19be2db0f3264197470096820ddd312e7169c4
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | .github/FUNDING.yml | 2 | ||||
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | Cargo.toml.orig | 6 | ||||
-rw-r--r-- | METADATA | 23 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/lib.rs | 28 |
9 files changed, 60 insertions, 26 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index d5c8f1d..2273b47 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,6 +1,6 @@ { "git": { - "sha1": "5bea3c7986c2a5c6763ca1b3f6d6982aca7cdc23" + "sha1": "7c03fc930cc47a9b94e8ca66ca44ef1a454c8f51" }, "path_in_vcs": "" }
\ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9954063 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: seanmonstar +patreon: seanmonstar @@ -42,7 +42,7 @@ rust_library { host_supported: true, crate_name: "num_cpus", cargo_env_compat: true, - cargo_pkg_version: "1.15.0", + cargo_pkg_version: "1.16.0", srcs: ["src/lib.rs"], edition: "2015", rustlibs: ["liblibc"], @@ -63,7 +63,7 @@ rust_test { name: "num_cpus_test_src_lib", crate_name: "num_cpus", cargo_env_compat: true, - cargo_pkg_version: "1.15.0", + cargo_pkg_version: "1.16.0", srcs: ["src/lib.rs"], test_suites: ["general-tests"], auto_gen_config: true, diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be725c..72b3e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## v1.16.0 + +### Features + +- add support for AIX operating system + +### Fixes + +- update hermit-abi to 0.3.0 + ## v1.15.0 ### Fixes @@ -11,7 +11,7 @@ [package] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" authors = ["Sean McArthur <sean@seanmonstar.com>"] description = "Get the number of CPUs on a machine." documentation = "https://docs.rs/num_cpus" @@ -25,8 +25,8 @@ categories = ["hardware-support"] license = "MIT OR Apache-2.0" repository = "https://github.com/seanmonstar/num_cpus" -[target."cfg(all(any(target_arch = \"x86_64\", target_arch = \"aarch64\"), target_os = \"hermit\"))".dependencies.hermit-abi] -version = "0.2.6" - [target."cfg(not(windows))".dependencies.libc] version = "0.2.26" + +[target."cfg(target_os = \"hermit\")".dependencies.hermit-abi] +version = "0.3.0" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 5ebfd93..6c63fbf 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,7 +1,7 @@ [package] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" description = "Get the number of CPUs on a machine." authors = ["Sean McArthur <sean@seanmonstar.com>"] license = "MIT OR Apache-2.0" @@ -14,5 +14,5 @@ readme = "README.md" [target.'cfg(not(windows))'.dependencies] libc = "0.2.26" -[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies] -hermit-abi = "0.2.6" +[target.'cfg(target_os = "hermit")'.dependencies] +hermit-abi = "0.3.0" @@ -1,23 +1,20 @@ # This project was upgraded with external_updater. -# Usage: tools/external_updater/updater.sh update rust/crates/num_cpus -# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md +# Usage: tools/external_updater/updater.sh update external/rust/crates/num_cpus +# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md name: "num_cpus" description: "Get the number of CPUs on a machine." third_party { - url { - type: HOMEPAGE - value: "https://crates.io/crates/num_cpus" - } - url { - type: ARCHIVE - value: "https://static.crates.io/crates/num_cpus/num_cpus-1.15.0.crate" - } - version: "1.15.0" license_type: NOTICE last_upgrade_date { - year: 2023 + year: 2024 month: 2 - day: 3 + day: 2 + } + homepage: "https://crates.io/crates/num_cpus" + identifier { + type: "Archive" + value: "https://static.crates.io/crates/num_cpus/num_cpus-1.16.0.crate" + version: "1.16.0" } } @@ -1,8 +1,7 @@ # num_cpus [![crates.io](https://img.shields.io/crates/v/num_cpus.svg)](https://crates.io/crates/num_cpus) -[![Travis CI Status](https://travis-ci.org/seanmonstar/num_cpus.svg?branch=master)](https://travis-ci.org/seanmonstar/num_cpus) -[![AppVeyor status](https://ci.appveyor.com/api/projects/status/qn8t6grhko5jwno6?svg=true)](https://ci.appveyor.com/project/seanmonstar/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) @@ -110,7 +110,12 @@ pub fn get_physical() -> usize { } -#[cfg(not(any(target_os = "linux", target_os = "windows", target_os="macos", target_os="openbsd")))] +#[cfg(not(any( + target_os = "linux", + target_os = "windows", + target_os = "macos", + target_os = "openbsd", + target_os = "aix")))] #[inline] fn get_num_physical_cpus() -> usize { // Not implemented, fall back @@ -327,11 +332,31 @@ fn get_num_physical_cpus() -> usize { cpus as usize } +#[cfg(target_os = "aix")] +fn get_num_physical_cpus() -> usize { + match get_smt_threads_aix() { + Some(num) => get_num_cpus() / num, + None => get_num_cpus(), + } +} + +#[cfg(target_os = "aix")] +fn get_smt_threads_aix() -> Option<usize> { + let smt = unsafe { + libc::getsystemcfg(libc::SC_SMT_TC) + }; + if smt == u64::MAX { + return None; + } + Some(smt as usize) +} + #[cfg(any( target_os = "nacl", target_os = "macos", target_os = "ios", target_os = "android", + target_os = "aix", target_os = "solaris", target_os = "illumos", target_os = "fuchsia") @@ -413,6 +438,7 @@ fn get_num_cpus() -> usize { target_os = "macos", target_os = "ios", target_os = "android", + target_os = "aix", target_os = "solaris", target_os = "illumos", target_os = "fuchsia", |