Skip to content

Commit

Permalink
Replace usage of deprecated sysctl on macOS (#1919)
Browse files Browse the repository at this point in the history
The use of the sysctl hw.ncpu has long been deprecated and
should be replaced by hw.logicalcpu.
  • Loading branch information
brad0 authored Feb 6, 2025
1 parent 41e81b1 commit faaa266
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit faaa266

Please sign in to comment.