24.3 C
Jaipur
Friday, November 27, 2020

8 Ways to Check CPU Clock Speed on Linux

Must read

cPanel 2FA Bypass Exposes Tens of Millions of Websites to Hack

Digital Defense, Inc., a leader in vulnerability and threat management solutions, announced that its Vulnerability Research Team (VRT) exposed a previously undisclosed vulnerability affecting the cPanel &...

A CPU clock speed determines how fast your CPU can process instructions every second. It measures the number of cycles your CPU can execute, measured in GHz or Mhz. As it is hard to increase clock speed beyond a limit, multi-core processors have been introduced.

In Linux to check CPU speed, you have to get processor details and there are different tools available to fetch CPU information.

1. Using lscpu

Lscpu is a command used in Linux to display information about the CPU architecture. This command is a part of the util-linux package.

Run lscpu command and the ‘CPU MHz’ field shows the CPU speed:

$ sudo lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                1
On-line CPU(s) list:   0
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             1
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            23
Model:                 1
Model name:            AMD EPYC 7601 32-Core Processor
Stepping:              2
CPU MHz:               2199.998
BogoMIPS:              4401.32
Hypervisor vendor:     KVM
Virtualization type:   full
L1d cache:             64K
L1i cache:             64K
L2 cache:              512K
L3 cache:              16384K
NUMA node0 CPU(s):     0

2. Using Dmesg

Dmesg is a command used in Linux to display messages from the kernel ring buffer and dumped to /var/log/messages.

We can filter Dmesg output using grep command, to find cpu speed:

$ sudo dmesg | grep MHz
[    0.000018] tsc: Detected 2127.998 MHz processor

3. From /proc/cpuinfo file

The /proc/cpuinfo system file gives the individual speed for each CPU Core.system.

$ cat /proc/cpuinfo | grep MHz
cpu MHz		: 2127.998

4. Using i7z

The i7z is a dedicated tool for intel i3, i5, and i7 based CPUs to display processor states.

Run ‘sudo i7z’ command to gives the following output:

Cpu speed from cpuinfo 2128.00Mhz
cpuinfo might be wrong if cpufreq is enabled. To guess correctly try estimating via tsc
Linux's inbuilt cpu_khz code emulated now
True Frequency (without accounting Turbo) 2128 MHz

5. Using hwinfo

Hwinfo command is used in Linux to print detailed information about each hardware device.

Run the following command to get CPU speed:

$ sudo hwinfo –cpu

The following snapshot shows the output of the above command.

$ sudo hwinfo --cpu
01: None 00.0: 10103 CPU                                        
  [Created at cpu.465]
  Unique ID: rdCR.j8NaKXDZtZ6
  Hardware Class: cpu
  Arch: X86-64
  Vendor: "GenuineIntel"
  Model: 6.37.2 "Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz"
  Clock: 2125 MHz
  BogoMips: 4255.99

6. Using auto-cpufreq

Auto-cpufreq is a modern tool to automatically optimize CPU speed & power on the Linux platform. It actively monitors the laptop’s battery state, CPU usage, and system load for CPU speed and power optimization.

$ sudo auto-cpufreq --monitor

Linux distro: UNKNOWN distro UNKNOWN version
Linux kernel: 4.4.0-21-generic

Procesor: Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
Cores: 4
Architecture: x86_64
Driver: acpi-cpufreq

------------------------------ Current CPU states ------------------------------

CPU max frequency: 2133 MHz
CPU min frequency: 933 MHz

	 Usage  Temperature  Frequency
CPU0:	  2.0%    nan °C      933 MHzCPU1:	  0.0%    nan °C     1599 MHzCPU2:	  1.0%    nan °C      933 MHzCPU3:	  0.0%    nan °C      933 MHz

---------------------------- CPU frequency scaling ----------------------------

Battery is: discharging

Currently using: ondemand governor
Suggesting use of "powersave" governor

Total CPU usage: 1.5 %
Total system load: 0.06 

Load optimal, suggesting to set turbo boost: off
Warning: CPU turbo is not available
Currently turbo boost is: off

-------------------------------------------------------------------------------

			"auto-cpufreq" refresh in: 5^C

7. Using dmidecode

Dmidecode is a command used in Linux to gives detailed information about the system’s hardware components such as Processor, DIMMs, BIOS, etc in a human-readable format.

To print cpu speed, run:

$  sudo  dmidecode -t processor | grep "Speed"
    Max Speed: 5200 MHz
    Current Speed: 2666 MHz

8. Using Inxi script

Inxi is a featured rich and powerful script to print the system’s hardware information in Linux.

Run inxi command with ‘-C’ option to print the processor related information:

$ sudo  inxi -C
CPU:       Topology: Single Core model: Intel Core i3 M 330 bits: 64 type: 
	   MCP L2 cache: 3072 KiB Speed: 2128 MHz min/max: N/A Core speed (MHz): 1: 2128

Conclusion

In this article, we explored different commands to get the CPU speed information on Linux OS. Please provide your feedback in the below comment section.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

cPanel 2FA Bypass Exposes Tens of Millions of Websites to Hack

Digital Defense, Inc., a leader in vulnerability and threat management solutions, announced that its Vulnerability Research Team (VRT) exposed a previously undisclosed vulnerability affecting the cPanel &...