| 69 | } |
| 70 | |
| 71 | static cbm_system_info_t detect_system_macos(void) { |
| 72 | cbm_system_info_t info; |
| 73 | memset(&info, 0, sizeof(info)); |
| 74 | |
| 75 | info.total_cores = sysctl_int("hw.ncpu", DEFAULT_CORES); |
| 76 | info.perf_cores = sysctl_int("hw.perflevel0.physicalcpu", info.total_cores); |
| 77 | |
| 78 | /* If perflevel sysctls fail (Intel Mac), perf = total */ |
| 79 | int eff = sysctl_int("hw.perflevel1.physicalcpu", 0); |
| 80 | if (info.perf_cores + eff > info.total_cores) { |
| 81 | info.perf_cores = info.total_cores; |
| 82 | } |
| 83 | |
| 84 | info.total_ram = sysctl_size("hw.memsize", 0); |
| 85 | return info; |
| 86 | } |
| 87 | |
| 88 | #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
| 89 |
no test coverage detected