PSA: If you're reading and parsing /proc/cpuinfo
for anything, you should probably stop.
The CPU information you're probably looking for is available in structured form in /sys/devices/system/cpu
, no horrible text parsing required. And unlike /proc/cpuinfo
, the /sys
hierarchy is standardized across architectures (as much as is practical). In particular, you will not find CPU topology info in /proc/cpuinfo on non-x86 architectures.
Signed, ARM64 users who keep seeing things like "1 cpu, 1 core, 8 threads" in software written by x86 users (I'm looking at you, GeekBench).
@marcan I might be guilty of this.