The CPU cache query tool in Linux and the cpu cache query in linux

Source: Internet
Author: User

The CPU cache query tool in Linux and the cpu cache query in linux

In Linux, you can use the following tool to query the CPU cache:

Method 1:

$ Lscpu

L1d cache: 32 K <span style = "white-space: pre"> </span> (level-1 data cache) L1i cache: 32 K <span style = "white-space: pre "> </span> <span style =" font-family: Arial, Helvetica, sans-serif; "> (level-1 Instruction cache) </span> L2 cache: 256 K <span style = "white-space: pre"> </span> (second-level cache) L3 cache: 8192 K <span style = "white-space: pre "> </span> (level 3 cache)


Method 2:

$ cat /sys/devices/system/cpu/cpu0/cache/index0/size32K
$ cat /sys/devices/system/cpu/cpu0/cache/index0/level1
$ cat /sys/devices/system/cpu/cpu0/cache/index1/size32K
$ cat /sys/devices/system/cpu/cpu0/cache/index1/level1
$ cat /sys/devices/system/cpu/cpu0/cache/index2/size256K
$ cat /sys/devices/system/cpu/cpu0/cache/index2/level2
$ cat /sys/devices/system/cpu/cpu0/cache/index3/size8192K
$ cat /sys/devices/system/cpu/cpu0/cache/index3/level3

Method 3:

$ sudo dmidecode -t cache
However, there is a way out from the above results. The displayed L1 cache is 1024 kB, And the L2 cache is kB. The 8-core cache is not consistent with the implementation.

The program may be faulty. We do not recommend using dmidecode.


# dmidecode 2.12SMBIOS 2.7 present.Handle 0x003B, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L1Configuration: Enabled, Not Socketed, Level 1Operational Mode: Write BackLocation: InternalInstalled Size: 256 kBMaximum Size: 256 kBHandle 0x003C, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L2Configuration: Enabled, Not Socketed, Level 2Operational Mode: Write BackLocation: InternalInstalled Size: 1024 kBMaximum Size: 1024 kBHandle 0x003D, DMI type 7, 19 bytesCache InformationSocket Designation: CPU Internal L3Configuration: Enabled, Not Socketed, Level 3Operational Mode: Write BackLocation: InternalInstalled Size: 8192 kBMaximum Size: 8192 kB


Method 4:

$ Cat/proc/cpuinfo

cache size: 8192 KB

This only shows the size of the L3 cache, which is not accurate.


How to view CPU Cache

L1 Cache (first-level Cache) is the first high-speed Cache of the CPU, which is divided into data Cache and instruction Cache. The built-in L1 high-speed cache capacity and structure have a great impact on CPU performance. However, high-speed buffer memory is composed of static RAM and has a complex structure, when the area of the CPU core cannot be too large, the capacity of the L1-level high-speed cache cannot be too large. Generally, the L1 cache capacity of the server CPU is 32-256KB.

L2 Cache (second-level Cache) is the second-level high-speed Cache of the CPU, which is divided into two chips: internal and external. The internal chip second-level cache runs at the same speed as the clock speed, while the external second-level cache is only half of the clock speed. The L2 high-speed cache capacity also affects CPU performance. The principle is that the larger the cache capacity, the better. Currently, the maximum CPU capacity of a household is kb, the CPU L2 cache on servers and workstations is 256-1 MB, and some are 2 MB or 3 MB.

L3 Cache (three-level Cache) can be divided into two types: external Cache in the early stage and built-in Cache in the present. The actual function is that L3 cache applications can further reduce memory latency and improve the performance of the processor when computing large data volumes. Reducing memory latency and improving the computing capability of large data volumes is helpful for games. However, increasing the L3 cache in the server field still significantly improves the performance. For example, a configuration with a large L3 cache takes advantage of the physical memory, so the slow disk I/O subsystem can process more data requests. A processor with a large L3 cache provides more effective file system cache behavior and longer message and processor queue length. Www.jz5u.com

How to check cpu2-level cache

Start-Program-maintenance tools-Hardware Detection-Comprehensive hardware information detection-motherboard-central processor (CPU)
Happy every day !!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.