_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
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

오래 살지 못할 것이라는 예상이 나로 하여금 더 열심히 살게 하고 더 많은 일을 하도록 했다. (스티븐 호킹)