_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › CPU覲伎企Cscript

Contents

1 cscript
2 sql
3 危 磯(hyper-threading) 瑚讌


1 cscript #

Dim objWMIService, colItems, objItem, strComputer, intSocketsTotal, strSocketsAll
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
strSocketsAll = ""
intSocketsTotal = 0
For Each objItem In colItems
  Wscript.Echo "Socket Name: " & objItem.SocketDesignation
  If Instr(strSocketsAll, objItem.SocketDesignation) = 0 Then
    intSocketsTotal = intSocketsTotal + 1
    strSocketsAll = strSocketsAll & objItem.SocketDesignation
  End If
Next
WScript.Echo "Socket Count: " & intSocketsTotal


set wmi_service = GetObject("winmgmts:\\" & server_name) 
set wmi_objectset = wmi_service.InstancesOf("Win32_Processor") 

for each wmi_object in wmi_objectset 
  wscript.echo "Clock Speed: " & cstr(wmi_object.MaxClockSpeed) & " GHz"
  wscript.echo "Core Count: " & cstr(wmi_object.NumberOfCores) 
next 

set wmi_service = nothing 


C:\>cscript cpucount2.vbs
Microsoft (R) Windows Script Host 覯 5.7
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Socket Name: Socket 775
Socket Count: 1
Clock Speed: 2400 GHz
Core Count: 4

  • Socket Name:貅 企企.
  • Socket Count:貅 1螳. 讀, 覓朱Μ CPU螳襯 襷.
  • Clock Speed: CPU ろ朱.
  • Core Count:貊伎.

2 sql #

SELECT
     [value_in_use] AS [MAXDOP],
     os.*
 FROM
     sys.configurations,
     (SELECT
         COUNT (DISTINCT [parent_node_id]) AS [Nodes],
         COUNT (*) AS [Cores]
      FROM
         sys.dm_os_schedulers 
      WHERE
         [status] = 'VISIBLE ONLINE') AS os
 WHERE
     [name] = 'max degree of parallelism';
 GO

3 危 磯(hyper-threading) 瑚讌 #

wmic path Win32_processor get NumberOfCores, NumberOfLogicalProcessors

蟆郁骸: hyper threading enable 蟆曙
D:\>wmic path Win32_processor get NumberOfCores, NumberOfLogicalProcessors
NumberOfCores  NumberOfLogicalProcessors
4              8


D:\>



cmd
wmic

wmic shell(?)..
wmic:root\cli> CPU Get NumberOfCores,NumberOfLogicalProcessors /Format:List

hyper_threading.png
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

手規 螻 讌 讌 覈襯碁. (覦蟆渚)