Anzahl der CPUs ermitteln

  • Habt ihr noch eine Idee, wie ich unter WindowsXP, 2000 und 2003 die Anzahl der CPUs per WMI bestimmen kann?

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>
    $ip = "localhost"

    [/autoit] [autoit][/autoit] [autoit]

    $objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $ip & "\root\cimv2")

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "Anzahl CPUs", CPU_Sockets($ip))

    [/autoit] [autoit][/autoit] [autoit]

    Func CPU_Sockets($srv)
    Local $name, $colItems, $colItem, $ping, $socket, $i, $x, $j, $unique
    $ping = Ping($srv)
    If $ping Then
    $colItems = $objWMIService.ExecQuery("Select SocketDesignation from Win32_Processor", "WQL", 0x30)
    If IsObj($colItems) Then
    For $objItem In $colItems
    $socket &= $objItem.SocketDesignation & ";"
    $i += 1
    Next
    $x = StringSplit(StringMid($socket, 1, StringLen($socket) - 1), ";", 2)
    $unique = _ArrayUnique($x)
    $j = $i / $unique[0]
    SetError(0)
    Return $i
    Else
    SetError(1)
    Return "Error!"
    EndIf
    Else
    SetError(1)
    Return "Host not reachable"
    EndIf
    EndFunc

    [/autoit]

    Meine Idee war es, die eindeutigen SocketDesignation zu zählen und durch die Anzahl der logischen CPUs zu teilen, leider funzt das Ganze nicht immer, da trotz einer CPU die Anzahl der verschiedenen SocketDesignation > 1 ist!

    Z.B. auf einem Server mit einer CPU: Intel(R) Xeon(TM) Processor 2.666 GHz (x86 Family 6 Model 7 Stepping 6 -> 4 Cores) werden 2 verschiedene SocketDesignation zurückgegeben und somit ist die Rechnung falsch => 4:2 = 2

    Ab Vista+ gibt es unter Win32_Processor NumberOfCores und NumberOfLogicalProcessors!

    Ich möchte bei WMI bleiben, da ich Server Remote abfragen will!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Hmm echt problematisch unter XP...


    Man könnte es eventuell noch folgendermaßen machen:

    Spoiler anzeigen
    [autoit]

    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(64,"Prozessor","Anzahl der Kerne: " & _Processor())

    [/autoit] [autoit][/autoit] [autoit]

    Func _Processor($Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then SetError(-2, @error, 0)
    For $ObjItem In $ObjList
    Select
    Case StringInStr($ObjItem.Name,"Duo") <> 0
    $sReturn = 2
    Case StringInStr($ObjItem.Name,"Quad") <> 0
    $sReturn = 4
    EndSelect
    Next
    Return $sReturn
    EndFunc ;==>_Processor

    [/autoit]

    Ist nur ziemlich unglücklich da man es pflegen müsste :S

    21 is only half the truth.

  • Das hilft leider auch nicht, da Duo oder Quad nicht immer im Namen vorkommt! Ferner stimmt auch die Angabe selbst nicht immer!

    Beispiel: Intel(R) Pentium(R) III Xeon processor x86 Family 6 Model 23 Stepping 6 @ 2666 MHz

    Abhilfe ist nur teilweise gemacht:

    Windows versions NumberOfLogicalProcessors and NumberOfCores property can use.
    NumberOfLogicalProcessors and NumberOfCores property can not use in Windows XP Service Pack 2 and earlier.

    In Windows XP Service Pack 3, NumberOfLogicalProcessors and NumberOfCores property is available.

    In Windows Server 2003 Service Pack 2 and earlier, NumberOfLogicalProcessors and NumberOfCores property is not available. But applied KB932370 hotfix, NumberOfLogicalProcessors and NumberOfCores property is available.See

    The number of physical hyperthreading-enabled processors or the number of physical multicore processors is incorrectly reported in Windows Server 2003
    http://support.microsoft.com/kb/932370/

    In Windows Vista, NumberOfLogicalProcessors and NumberOfCores property is available.

    Quelle: http://msdn.microsoft.com/en-us/library/…28VS.85%29.aspx

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • hier ne UDF von Bitboy:

    Spoiler anzeigen
    [autoit]

    ;#####################################################################
    ;#
    ;# Funtion _GetCPUUsage()
    ;# Ermittelt die Auslastung der CPU, Multicore Kompatibel
    ;#
    ;# Rückgabewert: Array
    ;# Array[0] Anzahl der CPUs, Fehler wenn negativ
    ;# Array[n] Auslastung der n-ten CPU in Prozent
    ;#
    ;# Fehler: -1 Fehler beim 1. Dll Aufruf
    ;# -2 Fehler beim 2. Dll Aufruf
    ;# -3 Fehler beim 3. Dll Aufruf
    ;#
    ;# Autor: Bitboy
    ;#####################################################################
    Func _GetCPUUsage()
    Local Const $SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION = 8
    Local Const $SYSTEM_TIME_INFO = 3
    Local Const $tagS_SPPI = "int64 IdleTime;int64 KernelTime;int64 UserTime;int64 DpcTime;int64 InterruptTime;long InterruptCount"

    [/autoit] [autoit][/autoit] [autoit]

    Local $CpuNum, $IdleOldArr[1],$IdleNewArr[1], $tmpStruct
    Local $timediff = 0, $starttime = 0
    Local $S_SYSTEM_TIME_INFORMATION, $S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
    Local $RetArr[1]

    [/autoit] [autoit][/autoit] [autoit]

    Local $S_SYSTEM_INFO = DllStructCreate("ushort dwOemId;short wProcessorArchitecture;dword dwPageSize;ptr lpMinimumApplicationAddress;" & _
    "ptr lpMaximumApplicationAddress;long_ptr dwActiveProcessorMask;dword dwNumberOfProcessors;dword dwProcessorType;dword dwAllocationGranularity;" & _
    "short wProcessorLevel;short wProcessorRevision")

    [/autoit] [autoit][/autoit] [autoit]

    ;Anzahl der CPUs bestimmen
    $err = DllCall("Kernel32.dll", "none", "GetSystemInfo", "ptr",DllStructGetPtr($S_SYSTEM_INFO))

    [/autoit] [autoit][/autoit] [autoit]

    If @error Or Not IsArray($err) Then ;Fehler beim 1. Dll Aufruf
    Return $RetArr[0] = -1
    Else
    $CpuNum = DllStructGetData($S_SYSTEM_INFO, "dwNumberOfProcessors")
    ReDim $RetArr[$CpuNum+1]
    $RetArr[0] = $CpuNum
    EndIf
    $S_SYSTEM_INFO = 0

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    ;Erstellen der Struktur für die Prozessor Performance
    $S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION = DllStructCreate($tagS_SPPI)
    ;Größe Struktur um später vielfache (MultiCore) der Structur lesen zu können
    $StructSize = DllStructGetSize($S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)
    ;Erstellen einer Pufferstruktur
    $S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION = DllStructCreate("byte puffer[" & $StructSize * $CpuNum & "]")
    ;Pointer zum wiederfinden
    $pointer = DllStructGetPtr($S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)

    [/autoit] [autoit][/autoit] [autoit]

    $err = DllCall("ntdll.dll", "int", "NtQuerySystemInformation", _
    "int", $SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, _
    "ptr", DllStructGetPtr($S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), _
    "int", DllStructGetSize($S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), _
    "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    ;Fehler beim 2. Dll Aufruf
    If $err[0] Then
    Return $RetArr[0] = -2
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;Struktur und Dll-Aufruf für Zeitmessung
    Local $S_SYSTEM_TIME_INFORMATION = DllStructCreate("int64;int64;int64;uint;int")
    $err = DllCall("ntdll.dll", "int", "NtQuerySystemInformation", _
    "int", $SYSTEM_TIME_INFO, _
    "ptr", DllStructGetPtr($S_SYSTEM_TIME_INFORMATION), _
    "int", DllStructGetSize($S_SYSTEM_TIME_INFORMATION), _
    "int", 0)

    [/autoit] [autoit][/autoit] [autoit]

    ;Fehler beim 3. Dll Aufruf
    If $err[0] Then
    Return $RetArr[0] = -3
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $starttime = 0 Then ;Startwerte Ermitteln
    ReDim $IdleOldArr[$CpuNum]
    ;Start-Informationen Auslesen
    For $i = 0 to $CpuNum -1
    $tmpStruct = DllStructCreate($tagS_SPPI, $Pointer + $i*$StructSize)
    $IdleOldArr[$i] = DllStructGetData($tmpStruct,"IdleTime")
    Next
    ;Startzeit ermitteln
    $starttime = DllStructGetData($S_SYSTEM_TIME_INFORMATION, 2)
    ;Verzögerung um einen Zeitunterschied sicher zu stellen
    Sleep(500)
    Else
    ReDim $IdleNewArr[$CpuNum]
    ;Neue Informationen auslesen
    For $i = 0 to $CpuNum -1
    $tmpStruct = DllStructCreate($tagS_SPPI, $Pointer + $i*$StructSize)
    $IdleNewArr[$i] = DllStructGetData($tmpStruct,"IdleTime")
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;Zeitdifferenze in 100 nanosekunden
    $timediff = DllStructGetData($S_SYSTEM_TIME_INFORMATION, 2) - $starttime

    [/autoit] [autoit][/autoit] [autoit]

    ;Auslastung errechnen
    For $i=0 to $CpuNum -1
    $RetArr[$i+1] = Round(100-(($IdleNewArr[$i] - $IdleOldArr[$i]) * 100 / $timediff))
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Return $RetArr
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;Speicher wieder frei geben
    $S_SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION = 0
    $S_SYSTEM_TIME_INFORMATION = 0
    $tmpStruct = 0
    WEnd
    EndFunc

    [/autoit]
  • So ich glaub ich habe es (hoffentlich :D)

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(64,"Prozessor","Anzahl der Kerne: " & _Processor())

    [/autoit] [autoit][/autoit] [autoit]

    Func _Processor($Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If StringInStr($ObjItem.Name,"_Total") = 0 Then $iReturn +=1
    Next
    Return $iReturn
    EndFunc ;==>_Processor

    [/autoit]

    Habe es unter Win7 x64 (QuadCore) und unter XPSP3 (Dual Core) in ner VM getestet

    21 is only half the truth.

  • Danke für deine Mühe, aber ich will nicht die Kerne, sondern die Anzahl der CPUs oder auch die belegten CPU Sockets mit einer CPU auf dem MB haben!

    Das Problem ist, dass man Zuhause i.d.R. nur eine CPU hat! Aber in der Serverwelt sieht das schon anders aus...

    Das MB eines Servers kann z.B. 4 Sockets haben, aber 2 sind nur belegt!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Sicherlich hab ich dich falsch verstanden aber geht es nicht so?:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"Anzahl CPUs", _GetCPUCount())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount(Const $sPC = "localhost")
    Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
    Return $oWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 16).Count
    EndFunc

    [/autoit]
  • Sicherlich hab ich dich falsch verstanden aber geht es nicht so?:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"Anzahl CPUs", _GetCPUCount())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount(Const $sPC = "localhost")
    Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
    Return $oWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 16).Count
    EndFunc

    [/autoit]

    Hmmm, sieht interessant aus! Muss ich morgen mal testen, da ich gerade keinen Server zur Verügung habe!

    Ich hoffe nicht, dass Count die Anzahl der Sockets zurück gibt, was nicht gleich ist, mit der Belegung der Sockets!

    Aber mal sehen...

    Vielen Dank!

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Sicherlich hab ich dich falsch verstanden aber geht es nicht so?:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"Anzahl CPUs", _GetCPUCount())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount(Const $sPC = "localhost")
    Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
    Return $oWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 16).Count
    EndFunc

    [/autoit]


    Hier das Resultat beider Skripts:

    Test Plattform
    1) HP ProLiant DL580 G5 mit 2 x Intel(R) Xeon(TM) Processor MP 2.4 GHz (x64 Family 6 Model 13 Stepping 1) auf einem 4 CPU Sockel MB -> 8 logische CPUs
    Mahagon: 8
    AspirinJunkie: 8

    2) ProLiant DL360 G5 mit 1 x Intel(R) Xeon(TM) Processor 2.666 GHz (x86 Family 6 Model 7 Stepping 6) auf einem 2 CPU Sockel MB -> 4 logische CPUs
    Mahagon: 4
    AspirinJunkie: 4

    Beide CPUs sind 4 Core CPUs!

    Jetzt muss ich mir nur noch überlegen, ob ich mit den Infos oben die Anzahl der CPUs errechnen kann, wobei ich HT noch berücksichtigen muss...

    DANKE,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Hm also unter Windows 7 wird es bei mir korrekt dargestellt (ohne Hyperthreading)

    Spoiler anzeigen
    [autoit]


    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(64, "Prozessor", "Anzahl CPUs: " & _GetCPUCount() & @CRLF & "Anzahl der Kerne: " & _GetCoreCount())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCoreCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
    Next
    Return $iReturn
    EndFunc ;==>_GetCoreCount

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_Processor', 'WQL', $wbemFlagReturnImmediately)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    Return $ObjList.Count
    EndFunc ;==>_GetCPUCount

    [/autoit]

    [Blockierte Grafik: http://img819.imageshack.us/img819/1443/cpucount.png]

    Es ist ja scheinbar so, dass HT nur Einfluss auf die CPU Anzahl hat, die Anzahl der Cores stimmt ja bei dir soweit.


    EDIT : Eventuell kann man es ja an der Device ID erkennen. Bin nicht in der Firma deshalb kann ichs leider nicht testen

    Spoiler anzeigen
    [autoit]

    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(64, "Prozessor", "Anzahl CPUs: " & _GetCPUCount() & @CRLF & "Anzahl der Kerne: " & _GetCoreCount())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCoreCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_PerfRawData_PerfOS_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If StringInStr($ObjItem.Name, "_Total") = 0 Then $iReturn += 1
    Next
    Return $iReturn
    EndFunc ;==>_GetCoreCount

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount(Const $Computer = "127.0.0.1")
    $WMIConnect = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & $Computer & '\root\CIMV2')
    If Not IsObj($WMIConnect) Then Return SetError(-1, @error, 0)
    $ObjList = $WMIConnect.ExecQuery('SELECT Name FROM Win32_Processor', 'WQL', $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If Not IsObj($ObjList) Then Return SetError(-2, @error, 0)
    $iReturn = 0
    For $ObjItem In $ObjList
    If $ObjItem.DeviceID = "CPU" & $iReturn Then $iReturn += 1
    Next
    Return $iReturn
    EndFunc ;==>_GetCPUCount

    [/autoit]

    21 is only half the truth.

    Einmal editiert, zuletzt von Mahagon (10. Juni 2010 um 10:19)

  • Hier das Resultat deines Skriptes:
    Test Plattform 1) -> Anzahl CPUs: 8 / Anzahl der Kerne: 8 -> sollte CPUs: 2 / Kerne: 8 sein
    Test Plattform 2) -> Anzahl CPUs: 4 / Anzahl der Kerne: 4 -> sollte CPUs: 1 / Kerne: 4 sein

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Was du unter Win32_PerfRawData_PerfOS_Processor ausliest, bekommst du auch unter Win32_ComputerSystemProcessor oder Win32_ComputerSystem (NumberOfProcessors) herraus.

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Hmm

    Zitat

    Hier das Resultat deines Skriptes:
    Test Plattform 1) -> Anzahl CPUs: 8 / Anzahl der Kerne: 8 -> sollte CPUs: 2 / Kerne: 8 sein
    Test Plattform 2) -> Anzahl CPUs: 4 / Anzahl der Kerne: 4 -> sollte CPUs: 1 / Kerne: 4 sein

    Ich bin ja kein Prof. aber ich denke mal das würde funktionieren:
    Was passiert wenn man die Anzahl der CPUs die zurückgegeben werden mal durch vier teilt?

    [autoit]


    $ergebnis=$ergebnis/4

    [/autoit]

    :rolleyes: Also vieleicht nicht die beste Lösung (vieleicht sogar die falsche aber denke mal das das so richtig ist...

    Edit: Bei mir
    Anzahl CPUs: 1
    Anzahl der Kerne: 2
    Na ok ich denke ich habe keine 1/4 CPUs.
    Ich habe Win7 32Bit

    Ich denke es liegt daran das deiner eine neue Technologie hat. Dann teilt man durch 4 sonst nicht.

    Nur keine Hektik - das Leben ist stressig genug

  • Er hat bei beiden anscheinend 4 Kern Prozessoren drin und Hyperthreading aktiviert.. einfach durch 4 teilen wird nicht funktionieren
    Aber es scheint so als würde unter XP/2003 jeder Kern eine Device ID zu bekommen... schade eigentlich ^^

    21 is only half the truth.

  • Das Problem ist, dass z.B. das MB 2 Socket hat, aber nur eine CPU installiert ist. Wenn das Ergebnis 4 ist, weiß ich nicht, ob 1x Quad Core oder 2x Dual Core CPUs eingebaut ist bzw. sind!

    Wenn man dies irgendwie unterscheiden könnte, könnte man die CPU errechnen.

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Kannst du vielleicht mal posten was so ein System alles zurückgibt in Win32_Processor
    (also alle Rückgaben - nicht bloß eine)?
    Jetzt interessiert es mich halt auch und testen kann ich hier ja nicht da ich alle meine Server grade verlegt habe... ;)
    Weil könnte mir dann derartige Ansätze vorstellen:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"Anzahl CPUs", _GetCPUCount2())
    MsgBox(0,"Anzahl CPUs", _GetCPUCount3())

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount2(Const $sPC = "localhost")
    Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
    Return $oWMI.ExecQuery('SELECT * FROM Win32_Processor WHERE Availability=3', "WQL", 16).Count
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetCPUCount3(Const $sPC = "localhost")
    Local $oWMI = ObjGet("winmgmts:\\" & $sPC & "\root\CIMV2")
    Return $oWMI.ExecQuery('SELECT * FROM Win32_Processor WHERE CpuStatus=1', "WQL", 16).Count
    EndFunc

    [/autoit]


    Aber dazu müsste ich wissen was so alles zurückgegeben wird von den einzelnen Kernen bzw. logischen Prozessoren..

  • Kein Problem:

    Test Plattform 1:
    OS: Windows 2003 R2 Std. SP2 x32

    Spoiler anzeigen

    ==========================================
    Computer: Test Plattform 1
    ==========================================
    AddressWidth: 32
    Architecture: 0
    Availability: 3
    Caption: x86 Family 6 Model 23 Stepping 6
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2666
    CurrentVoltage: 14
    DataWidth: 32
    Description: x86 Family 6 Model 23 Stepping 6
    DeviceID: CPU0
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1333
    Family: 176

    L2CacheSize: 12288
    L2CacheSpeed: 2666
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2666
    Name: Intel(R) Pentium(R) III Xeon processor
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF00010676
    ProcessorType: 3
    Revision: 5894
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 6
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 1
    UniqueId:
    UpgradeMethod: 9
    Version: Model 7, Stepping 6
    VoltageCaps:

    AddressWidth: 32
    Architecture: 0
    Availability: 3
    Caption: x86 Family 6 Model 23 Stepping 6
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 0
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2666
    CurrentVoltage: 14
    DataWidth: 32
    Description: x86 Family 6 Model 23 Stepping 6
    DeviceID: CPU1
    ErrorCleared:
    ErrorDescription:
    ExtClock: 200
    Family: 17

    L2CacheSize: 0
    L2CacheSpeed: 2666
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2666
    Name: Intel(R) Pentium(R) III processor
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: 0000000000000000
    ProcessorType: 3
    Revision: 5894
    Role: CPU
    SocketDesignation: Proc 2
    Status: OK
    StatusInfo: 3
    Stepping: 6
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 1
    UniqueId:
    UpgradeMethod: 20
    Version: Model 7, Stepping 6
    VoltageCaps:

    AddressWidth: 32
    Architecture: 0
    Availability: 3
    Caption: x86 Family 6 Model 23 Stepping 6
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2666
    CurrentVoltage: 14
    DataWidth: 32
    Description: x86 Family 6 Model 23 Stepping 6
    DeviceID: CPU2
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1333
    Family: 176

    L2CacheSize: 12288
    L2CacheSpeed: 2666
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2666
    Name: Intel(R) Pentium(R) III Xeon processor
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF00010676
    ProcessorType: 3
    Revision: 5894
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 6
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 1
    UniqueId:
    UpgradeMethod: 9
    Version: Model 7, Stepping 6
    VoltageCaps:

    AddressWidth: 32
    Architecture: 0
    Availability: 3
    Caption: x86 Family 6 Model 23 Stepping 6
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2666
    CurrentVoltage: 14
    DataWidth: 32
    Description: x86 Family 6 Model 23 Stepping 6
    DeviceID: CPU3
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1333
    Family: 176

    L2CacheSize: 12288
    L2CacheSpeed: 2666
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2666
    Name: Intel(R) Pentium(R) III Xeon processor
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF00010676
    ProcessorType: 3
    Revision: 5894
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 6
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 1
    UniqueId:
    UpgradeMethod: 9
    Version: Model 7, Stepping 6
    VoltageCaps:



    Test Plattform 2:
    OS: Windows 2003 Ent. SP2 x64

    Spoiler anzeigen

    ==========================================
    Computer: Test Plattform 2
    ==========================================
    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU0
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 4
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU1
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 2
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 0
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU2
    ErrorCleared:
    ErrorDescription:
    ExtClock: 200
    Family: 2

    L2CacheSize: 0
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: 0000000000000000
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 3
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 0
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU3
    ErrorCleared:
    ErrorDescription:
    ExtClock: 200
    Family: 2

    L2CacheSize: 0
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 2
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: 0000000000000000
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 4
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU4
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU5
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU6
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    AddressWidth: 64
    Architecture: 9
    Availability: 3
    Caption: EM64T Family 6 Model 29 Stepping 1
    ConfigManagerErrorCode:
    ConfigManagerUserConfig:
    CpuStatus: 1
    CreationClassName: Win32_Processor
    CurrentClockSpeed: 2400
    CurrentVoltage: 12
    DataWidth: 64
    Description: EM64T Family 6 Model 29 Stepping 1
    DeviceID: CPU7
    ErrorCleared:
    ErrorDescription:
    ExtClock: 1066
    Family: 2

    L2CacheSize: 6144
    L2CacheSpeed:
    LastErrorCode:
    Level: 6
    LoadPercentage: 0
    Manufacturer: GenuineIntel
    MaxClockSpeed: 2400
    Name: Intel(R) Xeon(R) CPU E7440 @ 2.40GHz
    OtherFamilyDescription:
    PNPDeviceID:
    PowerManagementCapabilities:
    PowerManagementSupported: False
    ProcessorId: BFEBFBFF000106D1
    ProcessorType: 3
    Revision: 7425
    Role: CPU
    SocketDesignation: Proc 1
    Status: OK
    StatusInfo: 3
    Stepping: 1
    SystemCreationClassName: Win32_ComputerSystem
    SystemName: Test Plattform 2
    UniqueId:
    UpgradeMethod: 4
    Version: Model 13, Stepping 1
    VoltageCaps:

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Also bis auf SocketDesignation welches du ja auch schon probiert hast ist mir bei Win32_Processor leider nichts aufgefallen was weiterhelfen könnte.
    Das von Mahagon angesprochene Win32_PerfRawData_PerfOS_Processor hab ich bei meinem Rechner z.B. gar nicht und Win32_ComputerSystemProcessor und Win32_ComputerSystem wirst du ja auch schon ausgiebig probiert haben.
    Hm schade - ich schau morgen mal in Ruhe ob mir vielleicht nochmal irgendwo was auffällt.