Linux - 有没有办法通过软件识别内存的速度?

Linux - 有没有办法通过软件识别内存的速度?

有没有办法通过软件识别内存速度?我使用的是 Fedora 9,想了解目前内存中的 DIMM 的速度。

我试过“lshw”,但它没有显示速度。我知道主板支持 3 种不同的速度,但我不知道那里面有什么,也不想关闭盒子。

有任何想法吗?

谢谢,

编辑:根据 dmidecode,我发现 RAM 为“30 ns”。如果主板仅支持 400、533、667 Mhz RAM,它怎么会是 33 MHz?

编辑2:还有其他工具可以做到这一点吗?



编辑 3:我实际上放弃了,最后关机几分钟,打开了机壳。结果是 667 MhZ - 这个型号:http://www.directron.com/rm12864aa667.html。尽管无法通过软件真正弄清楚它是 667,但我已将 HD 的答案标记为正确答案,因为这似乎是完成这项工作的最佳工具。




以下是 demidecode --type memory 的输出

# dmidecode 2.7
SMBIOS 2.4 present.

Handle 0x0008, DMI type 5, 20 bytes.
Memory Controller Information
    Error Detecting Method: 64-bit ECC
    Error Correcting Capabilities:
        None
    Supported Interleave: One-way Interleave
    Current Interleave: One-way Interleave
    Maximum Memory Module Size: 1024 MB
    Maximum Total Memory Size: 2048 MB
    Supported Speeds:
        70 ns
        60 ns
        50 ns
    Supported Memory Types:
        DIMM
        SDRAM
    Memory Module Voltage: 3.3 V
    Associated Memory Slots: 2
        0x0009
        0x000A
    Enabled Error Correcting Capabilities:
        None

Handle 0x0009, DMI type 6, 12 bytes.
Memory Module Information
    Socket Designation: DIMM0
    Bank Connections: 9 11
    Current Speed: 30 ns
    Type: Unknown FPM Parity SDRAM
    Installed Size: 1024 MB (Single-bank Connection)
    Enabled Size: 1024 MB (Single-bank Connection)
    Error Status: OK

Handle 0x000A, DMI type 6, 12 bytes.
Memory Module Information
    Socket Designation: DIMM1
    Bank Connections: 9 11
    Current Speed: 30 ns
    Type: Unknown FPM Parity SDRAM
    Installed Size: 1024 MB (Single-bank Connection)
    Enabled Size: 1024 MB (Single-bank Connection)
    Error Status: OK

Handle 0x002F, DMI type 16, 15 bytes.
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 4 GB
    Error Information Handle: Not Provided
    Number Of Devices: 2

Handle 0x0031, DMI type 17, 27 bytes.
Memory Device
    Array Handle: 0x002F
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM0
    Bank Locator: BANK0
    Type: SDRAM
    Type Detail: Synchronous
    Speed: Unknown
    Manufacturer: Manufacturer0
    Serial Number: SerNum0
    Asset Tag: AssetTagNum0
    Part Number: PartNum0

Handle 0x0033, DMI type 17, 27 bytes.
Memory Device
    Array Handle: 0x002F
    Error Information Handle: Not Provided
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM1
    Bank Locator: BANK1
    Type: SDRAM
    Type Detail: Synchronous
    Speed: Unknown
    Manufacturer: Manufacturer1
    Serial Number: SerNum1
    Asset Tag: AssetTagNum1
    Part Number: PartNum1

答案1

dmidecode 是您正在寻找的工具。

答案2

在我的 Debian 上,瘦身把那个信息告诉我。

# lshw -version
B.02.13
# lshw -short -C memory
H/W path             Device     Class       Description
=======================================================
/0/1                            memory      128KiB BIOS
/0/5/6                          memory      20KiB L1 cache
/0/5/7                          memory      1MiB L2 cache
/0/27                           memory      System Memory
/0/27/0                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/27/1                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/27/2                         memory      256MiB DIMM DDR Synchronous 266 MHz (3.8 ns)
/0/27/3                         memory      256MiB DIMM DDR Synchronous 400 MHz (2.5 ns)
/0/28                           memory      Flash Memory
/0/28/0                         memory      512KiB Chip FLASH Non-volatile
/0/0                            memory      
/0/2                            memory      

答案3

如果您真的想对内存速度进行基准测试,那么您不能在 32 位处理器 386 保护模式下进行此操作,因为页面错误和页表的布局会对结果产生很大的影响。

最好的选择是在 16 位“实模式”下对基准进行编码,在该模式下您可以直接访问内存物理地址。

要获得易于定制的优质启动代码,请查看 GRUB 引导加载程序 stage1 源代码。stage1 是位于硬盘前 512 个字节的 MBR。您可以在源目录 stage1/stage1.S 文件中找到它;它注释丰富,易于理解。

一旦您根据需要定制了 MBR,请使用以下方法进行编译:

$ BOOT=mbr
$ gcc -O2 -fno-builtin -nostdinc -falign-jumps=1 -falign-loops=1 -falign-functions=1 -Wundef -g -c $BOOT.S
$ gcc  -g  -nostdlib -Wl,-N,-Ttext,7C00 -o $BOOT.exec  $BOOT.o  
$ objcopy -O binary $BOOT.exec $BOOT

现在您已经准备好了 x86 MBR。最好先在 Qemu 或 Bochs 等虚拟机上测试您的代码,然后再在真实机器上运行;这也会简化编译/调试周期。

希望能帮助到你

答案4

需要澄清的是,您最后看到的 33mhz 内存是您的 BIOS 内存:)

    Type: Flash
    Type Detail: Non-Volatile
    Speed: 33 MHz
    Manufacturer: ATMEL

如果您想使用更好的工具,请安装 lm_sensors (https://wiki.archlinux.org/index.php/Lm_sensors)和 i2c-tools(https://www.archlinux.org/packages/?name=i2c-tools

然后,您可以使用 dimm-decode 获取有关内存的更多详细信息(这里是输出示例):

Decoding EEPROM: /sys/bus/i2c/drivers/eeprom/0-0055
Guessing DIMM is in                             bank 6

---=== SPD EEPROM Information ===---
EEPROM CRC of bytes 0-116                       OK (0x4422)
# of bytes written to SDRAM EEPROM              176
Total number of bytes in EEPROM                 256
Fundamental Memory type                         DDR3 SDRAM
Module Type                                     RDIMM

---=== Memory Characteristics ===---
Fine time base                                  2.500 ps
Medium time base                                0.125 ns
Maximum module speed                            1066MHz (PC3-8533)
Size                                            16384 MB
Banks x Rows x Columns x Bits                   8 x 15 x 11 x 64
Ranks                                           4
SDRAM Device Width                              4 bits
tCL-tRCD-tRP-tRAS                               7-7-7-20
Supported CAS Latencies (tCL)                   8T, 7T, 6T

---=== Timing Parameters ===---
Minimum Write Recovery time (tWR)               15.000 ns
Minimum Row Active to Row Active Delay (tRRD)   7.500 ns
Minimum Active to Auto-Refresh Delay (tRC)      50.625 ns
Minimum Recovery Delay (tRFC)                   160.000 ns
Minimum Write to Read CMD Delay (tWTR)          7.500 ns
Minimum Read to Pre-charge CMD Delay (tRTP)     7.500 ns
Minimum Four Activate Window Delay (tFAW)       37.500 ns

---=== Optional Features ===---
Operable voltages                               1.5V, 1.35V
RZQ/6 supported?                                Yes
RZQ/7 supported?                                Yes
DLL-Off Mode supported?                         Yes
Operating temperature range                     0-95C
Refresh Rate in extended temp range             1X
Auto Self-Refresh?                              No
On-Die Thermal Sensor readout?                  No
Partial Array Self-Refresh?                     No
Thermal Sensor Accuracy                         0
SDRAM Device Type                               0

---=== Physical Characteristics ===---
Module Height (mm)                              30
Module Thickness (mm)                           4 front, 4 back
Module Width (mm)                               133.5
Module Reference Card                           F

---=== Registered DIMM ===---
# DRAM Rows                                     2
# Registers                                     2
Register manufacturer                           IDT
Register device type                            SSTE32882
Register revision                               0x61
Heat spreader characteristics                   00
SSTE32882 RC0/RC1                               00
SSTE32882 RC2/RC3                               50
SSTE32882 RC4/RC5                               50
SSTE32882 RC6/RC7                               00
SSTE32882 RC8/RC9                               00
SSTE32882 RC10/RC11                             00
SSTE32882 RC12/RC13                             00
SSTE32882 RC14/RC15                             00

---=== Manufacturer Data ===---
Module Manufacturer                             Samsung
DRAM Manufacturer                               Samsung
Manufacturing Location Code                     0x02
Manufacturing Date                              2011-W39
Assembly Serial Number                          xxx
Part Number                                     M393B2K70CM0-YF8

相关内容