我该如何检测当前内存配置?我需要向Windows询问RAM当前是否以单通道、双通道还是四通道运行。
我已经搜索了很多,但在这个或其他网站上都没有找到类似的问题,这让我感到非常惊讶。
我正在使用 C++
,但这个问题对所有编程语言都适用,因为它关于哪个Windows函数或 powershell
/cmd
命令能给我所需信息。
我该如何检测当前内存配置?我需要向Windows询问RAM当前是否以单通道、双通道还是四通道运行。
我已经搜索了很多,但在这个或其他网站上都没有找到类似的问题,这让我感到非常惊讶。
我正在使用 C++
,但这个问题对所有编程语言都适用,因为它关于哪个Windows函数或 powershell
/cmd
命令能给我所需信息。
InterleavePosition
是你要找的东西。其中一个输出是 2,2,2
,因为它在双通道模式下运行了 3 根内存条。你需要找出如何识别单通道模式下运行的机器,以便使用此命令的输出:
wmic memorychip get InterleavePosition
编辑:实际上我对于使用3根内存条的双通道并不确定。一些研究表明,现在大多数主板会将奇数个内存条设置为单通道。
因此,从MSDN上来看,这就是我们需要挖掘有关交错内存系统信息的内容。
Position of the physical memory in an interleave. For example, in a 2:1 interleave, a value of "1" indicates that the memory is in the "even" position.
This property is inherited from CIM_PhysicalMemory.
0 - Noninterleaved
1 - First position
2 - Second position
另外还有一个 InterleaveDataDepth
参数,它的含义如下:
InterleaveDataDepth
Unsigned 16-bit integer maximum number of consecutive rows of data that are accessed in a single interleaved transfer from the memory device. If the value is 0 (zero), the memory is not interleaved.
它与多通道内存架构不同,主要是因为交错内存没有在主内存和内存控制器之间添加更多通道。然而,通道交错也是可能的… []
使用这个,我将分享一下使用cmd.exe在双通道中有4个RAM条的情况:
编辑: 一些人已经确认这些数值在某些机器上可以正常工作,但是很多时候会返回令人困惑/无意义的数值。wmic
是 C:\Windows\System32\wbem\WMIC.exe
。 - Maximilian Burszley0
。我应该如何解释这个数据?在只有一个内存模块的情况下,很容易知道它肯定是单通道的,但是两个运行单通道的内存模块很可能会显示0,0
或2,2
,那么我该如何从中检测出通道的数量呢? - JohnAl7.38 Memory Channel (Type 37)
Offset Name Length Value Description 06h Memory Device Count(n) BYTE Varies Number of Memory Devices (Type 11h) that are associated with this channel This value also defines the number of Load/Handle pairs that follow.您应该阅读带有其关联通道的那些“Count(n)”内存设备。
Channel 1: DIMM #0
Channel 1: DIMM #1
Channel 2: DIMM #0
Channel 2: DIMM #1
Win32_PhysicalMemory
WMI 类,并访问DeviceLocator
成员来确定 RAM 安装在哪个 DIMM 插槽中。 - Maximilian Burszley