What is the correct way to view your CPU speed on Linux?

  • I found two commands to output information about my CPU: cat /proc/cpuinfo and lscpu. /proc/cpuinfo shows that my CPU speed is 2.1 Ghz, whereas lspcu says it is 3167 Mhz. Which one is correct?

    This is my exact output from cat /proc/cpuinfo about my processor speed:

    model name  : Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz

    And this is from lscpu:

    CPU MHz:               3225.234

    (For some reason, lscpu outputs differently every time, varying between 3100 and 3300 MHz)

    Your `/proc/cpuinfo` should also have a line that says `cpu MHZ: ...` which is the current speed. The 2.1 after the `@` is the base speed (without turbo boost).

    What is turbo boost? And so does this mean my speed is actually around 3.2 GHz?

    It's Intel's way of "hitting the gas" when needed. I guess your actual speed at the time was indeed around 3.2 GHz, you could also try e.g. for cpu0 with `cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq` (as root).

    Turbo Boost is a technology that changes the frequency of the processor depending of the number of cores you are using. If you use few cores, the frequency is increased to boost the performance and maintain a low temperature. You may check the Turbo Boost frequency tables to check how it increases.

  • To see the current speed of each core I do this:

    watch -n.1 "cat /proc/cpuinfo | grep \"^[c]pu MHz\""


    If your watch command does not work with intervals smaller than one second, modify the interval like so:

    watch -n1 "cat /proc/cpuinfo | grep \"^[c]pu MHz\""

    This displays the cpu speed of each core in real time.

    By running the following command, one or more times, from another terminal one can see the speed change with the above watch command, assuming SpeedStep is enabled (Cool'n'Quiet for AMD).

    echo "scale=10000; 4*a(1)" | bc -l &

    (This command uses bc to calculate pi to 10000 places.)

    I had to remove the `.` in your first command to make it work: `watch -n1 "cat /proc/cpuinfo | grep \"^[c]pu MHz\"" `

    this is a nifty way to do it, but I'd caution against running any command every .1 seconds, that is itself going to impact the cpu speed report. 1 second is plenty.

    @Lizardx Ordinarily I agree but in this case the CPU speed can increase and decrease faster than a 1 second interval, resulting in a lack of visible speed changes. Since modern processors are so fast, I initially thought my `SpeedStep` was not working when using 1 second as the interval. At a minimum, `.5` should be used if one doesn't want to go as fast as `.1 second` (although I have still missed seeing many of the speed changes at that rate.

    Try running top with the timers set to less than 1 second, you can see the cpu usage visibly. My guess is that what you may actually be seeing is the system generating your cpu speed info, that is, the generation of the cpu speed output is causing the cpu movement. I find that anything less than a second starts to directly cause the cpu speeds you are watching. For example, top at -d5 is 1% of cpu. At -d2 it's about 5%. You might find you're actually fooling yourself into thinking the cpu is doing something that you're making it do, heh. Output to shell is expensive too.

    Could try `watch -n0.1`, might work. Failing that, `while true; do cat /proc/cpuinfo | grep MHz; sleep 0.1; clear; done`, it flickers more than watch though.

    I have 64 processors and this only showed me the "top few" (one page worth of output...). However, adding `"... | column"` to the command helps and now I can see all 64 processor frequencies flickering on my screen.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM