This commit is contained in:
jon-chuang 2023-04-14 03:55:33 +08:00
parent b17d54eda3
commit 02b0fe86f2

View file

@ -42,11 +42,10 @@ int32_t get_num_physical_cores() {
int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0); int result = sysctlbyname("hw.perflevel0.physicalcpu", &num_physical_cores, &len, NULL, 0);
if (result == 0) { if (result == 0) {
return (int32_t) num_physical_cores; return (int32_t) num_physical_cores;
} else { }
int result = sysctlbyname("hw.physicalcpu", &num_physical_cores, &len, NULL, 0); result = sysctlbyname("hw.physicalcpu", &num_physical_cores, &len, NULL, 0);
if (result == 0) { if (result == 0) {
return (int32_t) num_physical_cores; return (int32_t) num_physical_cores;
}
} }
#elif defined(_WIN32) #elif defined(_WIN32)
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;