Linux cpu frequency monitor

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 

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

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.

6 Answers 6

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

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

This does not work on server CPUs such as the Intel Xeon series. On such machines it will show the base frequency only. To show the turbo frequency, you’ll need cpupower or turbostat. See @Maxim Egorushkin’s answer.

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

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

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.

Читайте также:  Удалить домашнюю директорию linux

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.

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:

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

This is the best solution if you have an Intel CPU. Cat’ing the cpuinfo gives you incorrect clock speeds. Just a note, you forgot to put the dash in «apt-get».

Well. it works with my Xeon processor only the output is garbled, maybe because I have two CPUs (I have a dual Xeon motherboard).

Unfortunately, i7z doesn’t seem to work properly on my Core i7-1165G7 – it says «unknown processor» (among other things) and aborts.

Another good tool from Intel itself is turbostat (from the linux-cpupower package). But this one has nicer output.

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.
Читайте также:  Рейтинг a для linux

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.

Читайте также:  Установка linux тонкие клиенты

Источник

Как посмотреть текущую частоту процессора в Linux

Системный монитор или программа top показывают относительную загруженность центрального процессора. Иногда нужно (или просто хочется) посмотреть частоту CPU в данный момент. В этой заметке я расскажу, как узнать, на какой частоте работает процессор в Linux, а также другие его характеристики, такие как температуру и напряжение.

i7z

Самой наглядной программой для просмотра частоты центрального процессора в реальном времени является i7z.

Установка в Ubuntu, Linux Mint, Kali Linux, Debian и их производные:

Для установки в Arch Linux, BlackArch и их производные:a

Программа постоянно обновляет данные и интерактивно показывает такие характеристики процессора для каждого ядра как:

В самом верху показана базовая частота процессора из cpuinfo, у меня на скриншоте это 2208.00Mhz.

Затем идёт настоящая частота (без учёта Turbo).

Также показан CPU Multiplier и Bus clock frequency (BCLK).

Далее идёт информация о сокетах — обычно в домашних компьютерах только один сокет, он обозначается цифрой 0. Также сказано, сколько ядер и сколько логических ядер.

Строка мультипликатор (Max TURBO Multiplier) содержит информацию о том, как умножается частота шины (Bus clock frequency (BCLK)) при Турбо ускорении (Turbo Boost) в зависимости он нагрузки на ядра. В моём скриншоте 41x/41x/40x/40x/39x/39x показывает умножение при нагрузке на соответствующее число ядер 1/2/3/4/5/6. То есть при нагрузке на 1 или 2 ядра, умножение будет 41x, соответственно максимальная частота 100.32 * 41 = 4113,12, то есть максимальная частота 4.1 Гигагерц. При нагрузке на шесть ядер: 100.32 * 39 = 3912,48, то есть максимальная частота 3.9 Гигагерц.

Real Current Frequency — это реальная текущая частота.

Далее идёт таблица со следующими полями:

  • Core [core-id] — номер ядра
  • Actual Freq (Mult.) — текущая частота
  • C0% — Загруженность процессора в процентах
  • Halt(C1)% — Работа процессора с остановками (Состояния когда >C0 означает режимы энергосбережения с холостым ходом)
  • C3 % — Ядра, работающие с PLL, отключены, и кэш ядра отключён
  • C6 % — Как C3 + состояние ядра сохраняется в кэше последнего уровня
  • C7 % — как и C6, но глубже
  • Temp — температура в данный момент на каждое ядро
  • Vcore — напряжение в данный момент на каждое ядро

Данные в таблице меняются каждую секунду. [core-id] соответствует числу core-id в /proc/cpuinfo

Сообщение ‘Garbage Values’ выводиться когда считываются «мусорные» (которые невозможно интерпретировать) значения.

Внешний вид i7z основан на ncurses. Обычно программ запускается без опций, но при желании вы можете настроить ведение журнала и отключить интерфейс.

i7z поддерживает следующие опции:

Вместо дозаписи, начать журнал заново (старый стирается):

Источник

Оцените статью
Adblock
detector