【问题标题】:How I can determine physical RAM installed on computer? (windows)如何确定计算机上安装的物理 RAM? (视窗)
【发布时间】:2017-05-01 07:18:46
【问题描述】:

如何在 Windows 中使用 c++ 将物理内存安装到我的计算机上? 我的意思不仅是可以GlobalMemoryStatusEx()的容量参数,还包括已用内存插槽的数量、内存类型(如DDR1/DDR2/DDR3)、插槽类型(DIMM/SO-DIMM)和内存总线的时钟频率。 我需要使用 SMBIOS 吗?或者有任何其他方式来获取此信息?

【问题讨论】:

  • 可能需要 WMI/SYMBIOS,是的。
  • 您的计算机是否符合CUDA 平台?如果是的话,那么这是我手中的方法

标签: c++ c windows winapi ram


【解决方案1】:

在我的机器上,您请求的大部分信息都可以通过 WMI 获得。看看Win32_PhysicalMemory 和相关的类。

比如我机器上wmic memorychip的输出是:

C:\>wmic memorychip
Attributes  BankLabel  Capacity     Caption          ConfiguredClockSpeed  ConfiguredVoltage  CreationClassName     DataWidth  Description      DeviceLocator   FormFactor  HotSwappable  InstallDate  InterleaveDataDepth  InterleavePosition  Manufacturer  MaxVoltage  MemoryType  MinVoltage  Model  Name             OtherIdentifyingInfo  PartNumber        PositionInRow  PoweredOn  Removable  Replaceable  SerialNumber  SKU  SMBIOSMemoryType  Speed  Status  Tag                TotalWidth  TypeDetail  Version
2           BANK 0     17179869184  Physical Memory  2133                  1200               Win32_PhysicalMemory  64         Physical Memory  ChannelA-DIMM0  12                                                                              Samsung       0           0           0                  Physical Memory                        M471A2K43BB1-CPB                                                    15741117           26                2133           Physical Memory 0  64          128
2           BANK 2     17179869184  Physical Memory  2133                  1200               Win32_PhysicalMemory  64         Physical Memory  ChannelB-DIMM0  12                                                                              Samsung       0           0           0                  Physical Memory                        M471A2K43BB1-CPB                                                    21251413           26                2133           Physical Memory 2  64          128

如以上链接所述,FormFactor 12 是 SODIMM。

值得注意的是电压(您没有要求,但通常是感兴趣的)和MemoryType,其文档在 MSDN 上已过时,而最近来自 DMTF 的 SMBIOS 文档包含枚举中的值对于 DDR4。等等

因此,您可能不得不或多或少地手动查看 SMBIOS 表。见:How to get memory information (RAM type, e.g. DDR,DDR2,DDR3?) with WMI/C++

【讨论】:

    猜你喜欢
    • 2012-02-08
    • 2019-05-27
    • 1970-01-01
    • 2012-05-24
    • 2021-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    相关资源
    最近更新 更多