Showing posts with label cpu frequency. Show all posts
Showing posts with label cpu frequency. Show all posts

Friday, January 27, 2017

how to find cpu frequency in linux ?

Frequency


CPU frequency scaling enables the operating system to scale the CPU frequency up or down in order to save power. CPU frequencies can be scaled automatically depending on the system load, in response to ACPI events, or manually by userspace programs.
CPU frequency scaling is implemented in the Linux kernel, the infrastructure is called cpufreq

The frequency/speed of the processor is reported by both lscpu and /proc/cpuinfo.
Method 1:
lscpu | grep -i mhz

Example :
ravi@linuxforfreshers.com:~$ lscpu | grep -i mhz
CPU MHz:               1596.000

Method 2:

cat /proc/cpuinfo | grep -i mhz | uniq
Example:
ravi@linuxforfreshers.com:~$ cat /proc/cpuinfo | grep -i mhz | uniq
cpu MHz                      : 1596.000

Method 3:
The change of frequency can be seen by monitoring the output of /proc/cpuinfo using watch.
$ watch -n 0.1 "cat /proc/cpuinfo | grep -i mhz"

Method 4:
Using lshw command
Example:
ravi@linuxforfreshers.com:~$ sudo lshw -c cpu | grep capacity
       capacity: 1596MHz

Method 5:
Using dmidecode
Example:
ravi@linuxforfreshers.com:~$ sudo dmidecode -t processor | grep "Speed"
            Max Speed: 6000 MHz
            Current Speed: 2133 MHz



You can also get the current cpu frequency with this command:
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Note : root access required using this command.
Example :
ravi@linuxforfreshers.com:~$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
2133000