1
0
mirror of https://github.com/google/benchmark.git synced 2025-03-31 14:40:29 +08:00

Replace usage of deprecated sysctl on macOS ()

The use of the sysctl hw.ncpu has long been deprecated and
should be replaced by hw.logicalcpu.
This commit is contained in:
Brad Smith 2025-02-06 05:53:21 -05:00 committed by GitHub
parent 41e81b1ca4
commit faaa266d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -483,7 +483,9 @@ int GetNumCPUsImpl() {
#ifdef BENCHMARK_HAS_SYSCTL
int num_cpu = -1;
constexpr auto* hwncpu =
#ifdef HW_NCPUONLINE
#if defined BENCHMARK_OS_MACOSX
"hw.logicalcpu";
#elif defined(HW_NCPUONLINE)
"hw.ncpuonline";
#else
"hw.ncpu";