Home >Operation and Maintenance >CentOS >How to check CPU usage in centos

How to check CPU usage in centos

WBOY
WBOYOriginal
2022-02-08 15:55:4916995browse

In centos, you can use the cat command to check the CPU usage. The function of this command is to connect files and print them to the standard output device. The syntax is "cat /proc/cpuinfo".

How to check CPU usage in centos

The operating environment of this article: centos 6.4 system, Dell G3 computer.

How to check cpu usage in centos

The example is as follows:

How to check CPU usage in centos

How to check CPU usage in centos

This picture is the server The detailed running status of the CPU focuses on understanding the number of CPUs, how many cores, whether it supports hyper-threading, etc. In the picture, we mainly look at the fields of processor, physical id, siblings, core id, and cpu cores.

1. All logical processors with the same physical ID share the same physical socket. Each physical id represents a unique physical package, that is, a CPU.

2.Siblings represents the number of logical CPUs located on a physical packaged CPU.

3. Each core id represents a unique processor core, and all logical CPUs with the same core id are located on the same processor core.

4. If there is more than one logical CPU with the same core id and physical id, it means that the system supports hyper-threading (HT) technology.

5. If there are two or more logical CPUs with the same physical id but different core ids, it means that this is a multi-core processor. The cpu cores field can also indicate whether multi-core is supported. .

You can query the CPU status through the following methods.

1. Number of logical CPUs:

cat /proc/cpuinfo | grep “processor” | wc –l

2. Number of physical CPUs:

cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc –l

3. Number of cores in each physical CPU:

cat /proc/cpuinfo | grep “cpu cores” | wc –l

4. Does it support hyper-threading? If two logical CPUs have the same "core id", then hyperthreading is turned on.

5. The number of logical CPUs in each physical CPU》

cat /proc/cpuinfo | grep “siblings”

6.The physical ids are all 0, indicating that there is only one physical processor

7.processor has Two different numbers, and both belong to the same physical ID, and the value of cpu cores is 2, which means that the CPU is dual-core, and each core has only one logical processor.

How to check CPU usage in centos

Recommended tutorial: "centos tutorial"

The above is the detailed content of How to check CPU usage in centos. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn