Many recent CPUs out there--Alder Lake from Intel and many big.LITTLE designs from ARM--have heterogeneous CPU topologies: some cores are faster than others. There exists good ways to detect such CPUs on Windows and macOS, but Linux/Android seems lacking.
On x86, there is a CPUID bit: leaf 7 page 0 EDX bit 15. But ARM's CPUID equivalent is privileged, so OS help is required.
Is there a good way on Linux to detect this?
For posterity:
- On Windows, use
GetLogicalProcessorInformationExto enumerate packages and cores, then look for.Processor.EfficiencyClassbeing different values among cores (queries usingRelationProcessorCore). - On macOS, use
sysctlbynameonhw.nperflevelsand check whether it exists and its value is greater than1.
I think (not that I've ever used the programming interface) that you're after libhwloc's cpuset.
From
aptitude show hwloc: