How to really check current cpu Hz? [duplicate]

All programs I've tried seem to be listing Hz from cpu's specifications not actually checking what the current Hz really is.

for example a processor is marketed with 4GHz.But this is the max (unless you over/under/clock) and if the cpu isn't doing anything or is getting too hot it will throttle down.

The program always will say 4Ghz even when the CPU is at 2Ghz.I want to avoid this and know the real Hz.

What programs actually check current cpu hz and not just read cpu specifications?


Solution 1:

You can easily check the current CPU frequency using the following command:

watch -n 0 "lscpu | grep 'MHz'"

You can also get the current cpu frequency with this command:

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

Most modern CPUs can adjust their clock frequency. The default governor on linux is "on demand" which keeps the clock speed low to save power when idle, and speeds it up to do work when needed.

Visit https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt for further details.