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

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

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

Note:

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


For intel i3, i5 and i7 based cpus there is a dedicated tool called i7z that shows current speed for all cpu cores.

From man page (description):

i7z runs the i7z, ncurses based, program without any options. i7z will print out the C-states and temperature for i3, i5 and i7 based Core processors from Intel (including Nehalems, Sandy Bridge and Ivy Bridge).

For ubuntu-based distributions you can install it by issuing this command:

sudo apt-get install i7z

then just run it (tool needs to be run with sudo):

sudo i7z

The Intel Core i7-4600U Processor supports Turbo Boost technology. It has a base frequency of 2.10GHz and a Max Turbo Frequency of 3.30GHz. That means that,

  • If you disable the Turbo Boost (in the BIOS setup menu), the CPU will work at 2.10GHz all the time.
  • When Turbo Boost is enabled and only one of the cores is working, the CPU will work at a maximum of 3.30GHz.
  • If Turbo Boost is enabled and all the cores are working, the CPU will work at 2.10GHz.

Obtaining current frequency

To determine if the Turbo Boost is activated and which is the current frequency, you can use cpupower frequency-info. For instance, for an old Intel Core i5-660 with Turbo Boost enabled, you will get the following.

$ cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 3.47 GHz
  available frequency steps: 3.47 GHz, 3.33 GHz, 2.53 GHz, 1.87 GHz, 1.20 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 1.20 GHz and 3.47 GHz.
              The governor "ondemand" may decide which speed to use
              within this range.
  current CPU frequency is 1.87 GHz.
  cpufreq stats: 3.47 GHz:82,67%, 3.33 GHz:0,00%, 2.53 GHz:0,00%, 1.87 GHz:0,06%, 1.20 GHz:17,28%  (3)
  boost state support:
    Supported: yes
    Active: yes
    25500 MHz max turbo 4 active cores
    25500 MHz max turbo 3 active cores
    25500 MHz max turbo 2 active cores
    25500 MHz max turbo 1 active cores

Note that the information states the hardware limits (1.20 GHz - 3.47 GHz), the possible frequencies (3.47 GHz, 3.33 GHz, 2.53 GHz, 1.87 GHz, 1.20 GHz) and the current frequency (1.87 GHz). You may find the technical information of these frequencies at the Intel website.

Frequency when TurboBoost is disabled

Note the difference when you run the same command with Turbo Boost disabled: In the boost state support section, the values for Supported and Active are no. Here, the CPU will be at the nominal/minimal value (1.20Ghz) all the time.

$ cpupower frequency-info
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 3.47 GHz
  available frequency steps: 3.47 GHz, 3.33 GHz, 2.53 GHz, 1.87 GHz, 1.20 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 1.20 GHz and 3.47 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz.
  cpufreq stats: 3.47 GHz:40,86%, 3.33 GHz:0,01%, 2.53 GHz:0,06%, 1.87 GHz:0,22%, 1.20 GHz:58,85%  (493)
  boost state support:
    Supported: no
    Active: no
    25500 MHz max turbo 4 active cores
    25500 MHz max turbo 3 active cores
    25500 MHz max turbo 2 active cores
    25500 MHz max turbo 1 active cores

You can disable the Turbo Boost using the BIOS or some Linux options/commands. The kernel support can be enabled/disabled using the /sys/devices/system/cpu/cpufreq/boost file.

Tags:

Linux

Cpu