This commit is contained in:
jon-chuang 2023-04-14 04:00:41 +08:00
parent 02b0fe86f2
commit 3fa8837068

View file

@ -37,15 +37,15 @@ int32_t get_num_physical_cores() {
}
}
#elif defined(__APPLE__) && defined(__MACH__)
int num_physical_cores;
int32_t num_physical_cores;
size_t len = sizeof(num_physical_cores);
int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0);
if (result == 0) {
return (int32_t) num_physical_cores;
return num_physical_cores;
}
result = sysctlbyname("hw.physicalcpu", &num_physical_cores, &len, NULL, 0);
if (result == 0) {
return (int32_t) num_physical_cores;
return num_physical_cores;
}
#elif defined(_WIN32)
SYSTEM_INFO sysinfo;