Debian Linux 伺服器 - L1 和 L2 快取的大小

Debian Linux 伺服器 - L1 和 L2 快取的大小

可能的重複:
Linux 中查找 L2 快取大小

我正在使用 Debian Linux Server,想知道 L1 和 L2 快取的大小。有人可以幫我嗎,如何得到它?

答案1

dmidecode應該會給你這個訊息。

例如,對於我的 CPU,它顯示以下輸出:

Handle 0x0002, DMI type 7, 19 bytes
Cache Information
    Socket Designation: L1-Cache
    Configuration: Enabled, Not Socketed, Level 1
    Operational Mode: Write Through
    Location: Internal
    Installed Size: 64 KB
    Maximum Size: 64 KB
    Supported SRAM Types:
            Synchronous
    Installed SRAM Type: Synchronous
    Speed: Unknown
    Error Correction Type: Single-bit ECC
    System Type: Data
    Associativity: 8-way Set-associative

Handle 0x0003, DMI type 7, 19 bytes
Cache Information
    Socket Designation: L2-Cache
    Configuration: Enabled, Not Socketed, Level 2
    Operational Mode: Write Through
    Location: Internal
    Installed Size: 256 KB
    Maximum Size: 256 KB
    Supported SRAM Types:
            Synchronous
    Installed SRAM Type: Synchronous
    Speed: Unknown
    Error Correction Type: Single-bit ECC
    System Type: Data
    Associativity: 8-way Set-associative

Handle 0x0004, DMI type 7, 19 bytes
Cache Information
    Socket Designation: L3-Cache
    Configuration: Enabled, Not Socketed, Level 3
    Operational Mode: Write Back
    Location: Internal
    Installed Size: 3072 KB
    Maximum Size: 3072 KB
    Supported SRAM Types:
            Synchronous
    Installed SRAM Type: Synchronous
    Speed: Unknown
    Error Correction Type: Single-bit ECC
    System Type: Unified
    Associativity: <OUT OF SPEC>

從這裡你可以看到我有一個64kb的L1緩存,一個256kb的L2快取和一個3072kb的L3快取。

答案2

看起來這是重複的

Linux 中查找 L2 快取大小

然而,在這兩種情況下,dmidecode 對我都不起作用,這是有道理的,因為它報告 BIOS 訊息,而這些訊息並不總是存在或準確。所以,對我來說最好的選擇是:

find /sys/devices/system/cpu/*/cache/index*/size -print -exec cat {} \;
/sys/devices/system/cpu/cpu0/cache/index0/size
32K
/sys/devices/system/cpu/cpu0/cache/index1/size
32K
/sys/devices/system/cpu/cpu0/cache/index2/size
6144K
/sys/devices/system/cpu/cpu1/cache/index0/size
32K
/sys/devices/system/cpu/cpu1/cache/index1/size
32K
/sys/devices/system/cpu/cpu1/cache/index2/size
6144K

答案3

您可以使用 lshw 來尋找快取資訊。如果未安裝,您應該從儲存庫中取得它。

答案4

如果您運行的是 i386/amd64 機器,x86info 是一個不錯的獲取處理器資訊的工具。

相關內容