【问题标题】:Finding the powershell CIM equivalent to columns from sys.dm_os_sys_info查找与 sys.dm_os_sys_info 中的列等效的 powershell CIM
【发布时间】:2020-01-10 04:06:28
【问题描述】:

我有一个普通的 SQL Server 选择,它从动态管理视图的这两列中收集信息:

SELECT cpu_count, hyperthread_ratio
FROM sys.dm_os_sys_info

我想知道是否有人通过 powershell CIM 系统硬件类知道精确的等价物?比如:

Get-CimInstance -ClassName Win32_Processor

但我对 PC 架构了解得不够多,无法知道其中的哪个属性(或基于其他属性的逻辑)直接等同于该 sql dmv 中的 cpu_count 和 hyperthread_ratio。

【问题讨论】:

    标签: sql-server powershell wmi


    【解决方案1】:

    您可以执行以下操作:

    $CPUData = @(Get-CIMInstance -Class Win32_Processor | Select NumberOfCores,NumberOfLogicalProcessors)
    $CPU_Count = ($CPUData.NumberOfLogicalProcessors | Measure -Sum).Sum
    [pscustomobject]@{'CPU_Count' = $CPU_Count
                      'Hyperthread_Ratio' = $CPU_Count/$CPUData.Count
                    }
    

    说明:

    Get-CIMInstance -Class Win32_Processor 返回属性NumberOfLogicalProcessorsNumberOfCores。当这两个属性值不同时,就会启用超线程。

    cpu_counthyperthread_ratio 只返回有关逻辑 CPU 的数据,因此我们只关心计算。

    如果没有计算(我可以找到),您想要的数据就不存在。 cpu_count 是逻辑处理器的总数(NumberOfLogicalProcessors 值的总和)。 hyperthread_ratio 是逻辑处理器总数除以 CPU 插槽总数。

    顺便说一句,我的测试表明 SQL 实例中的处理器亲和性不会影响 SQL 查询中的计算或数据。

    【讨论】:

      猜你喜欢
      • 2018-03-21
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 2011-01-07
      • 1970-01-01
      相关资源
      最近更新 更多