nench icon indicating copy to clipboard operation
nench copied to clipboard

Improve CPU detection to support more Linux-Distros like Gentoo based on ARM64 e.g.

Open coinblockers opened this issue 5 years ago • 3 comments

/proc/cpuinfo doesn't cotain all asked data on some linux distros. Thus preventing the script from fetching correct cpu info. Since lscpu gets shipped with every distro, use that as more safe base for fetching the cpu info. I also simplified the pattern filter by just using sed.

coinblockers avatar Sep 13 '19 14:09 coinblockers

Do you have an example of such an incomplete /proc/cpuinfo?

lscpu is only available on Linux systems, not *BSD, so I would need to add a fallback for those. I'd like to properly test changes like these to keep the output format consistent, so I'll have to postpone this for a bit longer.

n-st avatar Sep 25 '19 16:09 n-st

BSD doesnt even have a /proc/cpuinfo, so there is a fallback for BSD in the script already. lscpu only applies if [ "$(uname)" = "Linux" ] so it should not be an issue.

coinblockers avatar Oct 18 '19 09:10 coinblockers

Yeah, as an example on ARM64:

cat /proc/cpuinfo

processor	: 0
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
BogoMIPS	: 108.00
Features	: fp asimd evtstrm crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

lscpu

Architecture:        aarch64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               3
Model name:          Cortex-A72
Stepping:            r0p3
CPU max MHz:         1500.0000
CPU min MHz:         600.0000
BogoMIPS:            108.00
Flags:               fp asimd evtstrm crc32 cpuid

coinblockers avatar Oct 18 '19 09:10 coinblockers