I need to find out in my script if a (potentially legacy) CPU supports dynamic speed setting, and eventually get value of maximum and current speed. What makes it more complicated is that I need to support RHEL5 (kernel 2.6.18-371) as well, where tools like lscpu are not available, and also less common architectures like PowerPC or S390.

For example, I know that for x86 architectures, some features can be read from "flags" in /proc/cpuinfo, but how do I know what to search for?. Also on a ppc64 machine I have for testing, this flags field is missing, instead there is a similar looking field "features".

So what is the (most) universal approach? Is there a way that would work even on less common architectures like s390 or ppc?

What I tried (on Pentium III) was to just load all modules that have something to do with cpufreq (i.e. grepping through modules folder) and look if /sys/devices/system/cpu/cpu0/cpufreq exists after that. However, I wonder if this is all I can do before saying it's not supported.

  • You can parse some flags in /proc/cpuinfo, but that's obviously architecture-dependent, and there are several different CPU features that allow a variable size and I don't know if they're all listed there on x86 (and they aren't on ARM). – Gilles Jun 6 '14 at 0:30

This should work on RHEL 5.3:

dmidecode --type processor

and look for Max Speed and Current Speed info

  • I can't check on rhel5 right now, but on Fedora with i7, it does not work properly: it mentions only 1 CPU with current speed = maximum speed. cpufreq reports 4 different current/maximum pairs. – Alois Mahdal Jun 5 '14 at 17:52
  • ...also on rhel5 dmidecode is only available for Itanium or x86 processors, not PowerPC or s390 – Alois Mahdal Jun 5 '14 at 18:41

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.