5

My /proc/cpuinfo says my processor is 800Mhz, when I know the thing is actually 2.8Ghz. This is due to idle throttling where the cpu clock is slowed when idle to save power.

Is there a way in Linux to find the true cpu speed?

migrated from stackoverflow.com Nov 9 '11 at 1:12

This question came from our site for professional and enthusiast programmers.

13

The file /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq contains the maximum frequency in KHz (that directory, /sys/devices/system/cpu/cpu0/cpufreq, also contains a bunch of other cpu-frequency related information). It contains just a single ASCII number, so is much easier to parse than the stuff in /proc/cpuinfo or the dmesg output.

Note that this info is per-cpu, but of course maximum frequency will be the same for all cpus on most systems, so I just used cpu0.

BTW, on my system, the maximum frequency can be read by any user, but the current frequency (.../cpuinfo_cur_freq) can only be read by root; I don't know if this is true on all systems...

  • What systems does this work for? It worked for me on CentOs, but file does not exist on Ubuntu 10.04. – Fixee Oct 29 '11 at 3:36
  • @Fixee I think it should work on any reasonably mainstream linux system. I don't know exactly when it was added, but this feature seems to have been around for ages. A few guesses: (1) maybe the cpufreq kernel module isn't loaded; try installing the cpufrequtils package (that's the Debian package name, but I'd guess Ubuntu is similar), or (2) maybe they're mounting the sysfs filesystem someplace other than /sys; try df -a -t sysfs to see where it's mounted. – snogglethorpe Oct 29 '11 at 6:45
1

You can find out using grep and dmesg:

# dmesg | grep CPU
...
CPU0: Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz stepping 05
...
  • Unf the analogous line for me (CentOs 6, 2.6.32-71.el6.x86 kernel), is CPU0: AMD Opteron(tm) Processor 4184 stepping 01. – Fixee Oct 28 '11 at 0:39
  • As an aside, the info above (CPU0: ...) appears in /proc/cpuinfo as "model name" here. – Mel Boyce Oct 28 '11 at 3:04
0

lshal | grep info.product|grep GHz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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