Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

coinblockers
Copy link

/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.

@n-st
Copy link
Owner

n-st commented Sep 25, 2019

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.

@coinblockers
Copy link
Author

coinblockers commented Oct 18, 2019

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 coinblockers changed the title Improve CPU detection to support more Linux-Distros like Gentoo e.g. Improve CPU detection to support more Linux-Distros like Gentoo based on ARM64 e.g. Oct 18, 2019
@coinblockers
Copy link
Author

coinblockers commented Oct 18, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants