Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit faaa266

Browse files
authored
Replace usage of deprecated sysctl on macOS (#1919)
The use of the sysctl hw.ncpu has long been deprecated and should be replaced by hw.logicalcpu.
1 parent 41e81b1 commit faaa266

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sysinfo.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ int GetNumCPUsImpl() {
483483
#ifdef BENCHMARK_HAS_SYSCTL
484484
int num_cpu = -1;
485485
constexpr auto* hwncpu =
486-
#ifdef HW_NCPUONLINE
486+
#if defined BENCHMARK_OS_MACOSX
487+
"hw.logicalcpu";
488+
#elif defined(HW_NCPUONLINE)
487489
"hw.ncpuonline";
488490
#else
489491
"hw.ncpu";

0 commit comments

Comments
 (0)