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.
/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 'SO- stop being evil' Jun 06 '14 at 00:30