You get the number of cores with this:srod wrote:Can you post your code?
Here's some that I've just run. With a core 2 processor it only lists cpu0. Should it list two?
Code: Select all
IncludePath "..\.." XIncludeFile "COMate.pbi" Procedure Get_Processors() Protected objWMIService.COMateObject, processor.COMateObject Protected colProcessor.COMateEnumObject strComputer.s = "." objWMIService = COMate_GetObject("winmgmts:\" + strComputer + "\root\cimv2", "") If objWMIService colProcessor = objWMIService\CreateEnumeration("ExecQuery('Select * FROM Win32_Processor')") If colProcessor processor = colProcessor\GetNextObject() While processor Debug processor\GetStringProperty("DeviceID") processor\Release() processor = colProcessor\GetNextObject() Wend colProcessor\Release() EndIf objWMIService\Release() EndIf EndProcedure Get_Processors()
Code: Select all
Str(CPU\GetIntegerProperty("NumberOfCores"))
The for the number of logical processors you do this:
Code: Select all
Str(CPU\GetIntegerProperty("NumberOfLogicalProcessors"))
Here is a version i'm using that feeds a linked list (not shown), works in Vista (and mostly in XP but some of the things don't work in XP, not all of them are commented below - consult the MSDN. The L2CacheSpeed doesn't seem to work at all though. CPU_GUID depends on the processor serial number being on or off in BIOS I think. The hyperthreading part is just demostration only, I don't use it in actual use.):
Code: Select all
; CPU Families
Procedure.s CPU_Family_Type(cpu_famt.l)
  Select cpu_famt
  
    Case 1
      CPU_Fam_Type$ = "Other"
    Case 2
      CPU_Fam_Type$ = "Unknown"
    Case 3
      CPU_Fam_Type$ = "8086"
    Case 4
      CPU_Fam_Type$ = "80286"
    Case 5
      CPU_Fam_Type$ = "Intel386 Processor"
    Case 6
      CPU_Fam_Type$ = "Intel486 Processor"
    Case 7
      CPU_Fam_Type$ = "8087"
    Case 8
      CPU_Fam_Type$ = "80287"
    Case 9
      CPU_Fam_Type$ = "80387"
    Case 10
      CPU_Fam_Type$ = "80487"
    Case 11
      CPU_Fam_Type$ = "Pentium Brand"
    Case 12
      CPU_Fam_Type$ = "Pentium Pro"
    Case 13
      CPU_Fam_Type$ = "Pentium II"
    Case 14
      CPU_Fam_Type$ = "Pentium Processor With MMX Technology"
    Case 15
      CPU_Fam_Type$ = "Celeron"
    Case 16
      CPU_Fam_Type$ = "Pentium II Xeon"
    Case 17
      CPU_Fam_Type$ = "Pentium III"
    Case 18
      CPU_Fam_Type$ = "M1 Family"
    Case 19
      CPU_Fam_Type$ = "M2 Family"
    Case 24
      CPU_Fam_Type$ = "AMD Duron Processor Family"
    Case 25
      CPU_Fam_Type$ = "K5 Family"
    Case 26
      CPU_Fam_Type$ = "K6 Family"
    Case 27
      CPU_Fam_Type$ = "K6-2"
    Case 28
      CPU_Fam_Type$ = "K6-3"
    Case 29
      CPU_Fam_Type$ = "AMD Athlon Processor Family"
    Case 30
      CPU_Fam_Type$ = "AMD2900 Family"
    Case 31
      CPU_Fam_Type$ = "K6-2+"
    Case 32
      CPU_Fam_Type$ = "Power PC Family"
    Case 33
      CPU_Fam_Type$ = "Power PC 601"
    Case 34
      CPU_Fam_Type$ = "Power PC 603"
    Case 35
      CPU_Fam_Type$ = "Power PC 603+"
    Case 36
      CPU_Fam_Type$ = "Power PC 604"
    Case 37
      CPU_Fam_Type$ = "Power PC 620"
    Case 38
      CPU_Fam_Type$ = "Power PC X704"
    Case 39
      CPU_Fam_Type$ = "Power PC 750"
    Case 48
      CPU_Fam_Type$ = "Alpha Family"
    Case 49
      CPU_Fam_Type$ = "Alpha 21064"
    Case 50
      CPU_Fam_Type$ = "Alpha 21066"
    Case 51
      CPU_Fam_Type$ = "Alpha 21164"
    Case 52
      CPU_Fam_Type$ = "Alpha 21164PC"
    Case 53
      CPU_Fam_Type$ = "Alpha 21164a"
    Case 54
      CPU_Fam_Type$ = "Alpha 21264"
    Case 55
      CPU_Fam_Type$ = "Alpha 21364"
    Case 64
      CPU_Fam_Type$ = "MIPS Family"
    Case 65
      CPU_Fam_Type$ = "MIPS R4000"
    Case 66
      CPU_Fam_Type$ = "MIPS R4200"
    Case 67
      CPU_Fam_Type$ = "MIPS R4400"
    Case 68
      CPU_Fam_Type$ = "MIPS R4600"
    Case 69
      CPU_Fam_Type$ = "MIPS R10000"
    Case 80
      CPU_Fam_Type$ = "SPARC Family"
    Case 81
      CPU_Fam_Type$ = "SuperSPARC"
    Case 82
      CPU_Fam_Type$ = "microSPARC II"
    Case 83
      CPU_Fam_Type$ = "microSPARC IIep"
    Case 84
      CPU_Fam_Type$ = "UltraSPARC"
    Case 85
      CPU_Fam_Type$ = "UltraSPARC II"
    Case 86
      CPU_Fam_Type$ = "UltraSPARC IIi"
    Case 87
      CPU_Fam_Type$ = "UltraSPARC III"
    Case 88
      CPU_Fam_Type$ = "UltraSPARC IIIi"
    Case 96
      CPU_Fam_Type$ = "68040"
    Case 97
      CPU_Fam_Type$ = "68xxx Family"
    Case 98
      CPU_Fam_Type$ = "68000"
    Case 99
      CPU_Fam_Type$ = "68010"
    Case 100
      CPU_Fam_Type$ = "68020"
    Case 101
      CPU_Fam_Type$ = "68030"
    Case 112
      CPU_Fam_Type$ = "Hobbit Family"
    Case 120
      CPU_Fam_Type$ = "Crusoe TM5000 Family"
    Case 121
      CPU_Fam_Type$ = "Crusoe TM3000 Family"
    Case 122
      CPU_Fam_Type$ = "Efficeon TM8000 Family"
    Case 128
      CPU_Fam_Type$ = "Weitek"
    Case 130
      CPU_Fam_Type$ = "Itanium Processor"
    Case 131
      CPU_Fam_Type$ = "AMD Athlon 64 Processor Famiily"
    Case 132
      CPU_Fam_Type$ = "AMD Opteron Processor Family"
    Case 144
      CPU_Fam_Type$ = "PA-RISC Family"
    Case 145
      CPU_Fam_Type$ = "PA-RISC 8500"
    Case 146
      CPU_Fam_Type$ = "PA-RISC 8000"
    Case 147
      CPU_Fam_Type$ = "PA-RISC 7300LC"
    Case 148
      CPU_Fam_Type$ = "PA-RISC 7200"
    Case 149
      CPU_Fam_Type$ = "PA-RISC 7100LC"
    Case 150
      CPU_Fam_Type$ = "PA-RISC 7100"
    Case 160
      CPU_Fam_Type$ = "V30 Family"
    Case 176
      CPU_Fam_Type$ = "Pentium III Xeon Processor"
    Case 177
      CPU_Fam_Type$ = "Pentium III Processor With Intel SpeedStep Technology"
    Case 178
      CPU_Fam_Type$ = "Pentium 4"
    Case 179
      CPU_Fam_Type$ = "Intel Xeon"
    Case 180
      CPU_Fam_Type$ = "AS400 Family"
    Case 181
      CPU_Fam_Type$ = "Intel Xeon Processor MP"
    Case 182
      CPU_Fam_Type$ = "AMD Athlon XP Family"
    Case 183
      CPU_Fam_Type$ = "AMD Athlon MP Family"
    Case 184
      CPU_Fam_Type$ = "Intel Itanium 2"
    Case 185
      CPU_Fam_Type$ = "Intel Pentium M Processor"
    Case 190
      CPU_Fam_Type$ = "K7"
    Case 200
      CPU_Fam_Type$ = "IBM390 Family"
    Case 201
      CPU_Fam_Type$ = "G4"
    Case 202
      CPU_Fam_Type$ = "G5"
    Case 203
      CPU_Fam_Type$ = "G6"
    Case 204
      CPU_Fam_Type$ = "z/Architecture Base"
    Case 250
      CPU_Fam_Type$ = "i860"
    Case 251
      CPU_Fam_Type$ = "i960"
    Case 260
      CPU_Fam_Type$ = "SH-3"
    Case 261
      CPU_Fam_Type$ = "SH-4"
    Case 280
      CPU_Fam_Type$ = "ARM"
    Case 281
      CPU_Fam_Type$ = "StrongARM"
    Case 300
      CPU_Fam_Type$ = "6x86"
    Case 301
      CPU_Fam_Type$ = "MediaGX"
    Case 302
      CPU_Fam_Type$ = "MII"
    Case 320
      CPU_Fam_Type$ = "WinChip"
    Case 350
      CPU_Fam_Type$ = "DSP"
    Case 500
      CPU_Fam_Type$ = "Video Processor"
    Default
      CPU_Fam_Type$ = "Unknown"
  
  EndSelect
ProcedureReturn CPU_Fam_Type$
EndProcedure
Procedure.s CPU_Info() 
  Define.COMateObject objWMIService, CPU, PROC 
  procCPU.COMateEnumObject
  sysCPU.COMateEnumObject 
  strComputer.s = "." 
  objWMIService = COMate_GetObject("winmgmts:\" + strComputer + "\root\cimv2", "") 
  If objWMIService
    sysCPU = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_Processor')")  
    procCPU = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_ComputerSystem')") 
    If sysCPU And procCPU
      CPU = sysCPU\GetNextObject()
      PROC = procCPU\GetNextObject()
      While CPU
        
        My_Adapter_Info_List()\CPU_Proc_Num = Str(PROC\GetIntegerProperty("NumberOfProcessors"))
        My_Adapter_Info_List()\CPU_System_Type = PROC\GetStringProperty("SystemType")
        My_Adapter_Info_List()\CPU_Num_Core = Str(CPU\GetIntegerProperty("NumberOfCores")) ; doesn't work with Windows Server 2003, Windows XP, and Windows 2000
        My_Adapter_Info_List()\CPU_Num_Logical = Str(CPU\GetIntegerProperty("NumberOfLogicalProcessors")) ; doesn't work with Windows Server 2003, Windows XP, and Windows 2000
        My_Adapter_Info_List()\CPU_Manufacturer = CPU\GetStringProperty("Manufacturer")
        My_Adapter_Info_List()\CPU_ExtClock = Str(CPU\GetIntegerProperty("ExtClock"))
        cpu_famt.l = CPU\GetIntegerProperty("Family")
        My_Adapter_Info_List()\CPU_Family = CPU_Family_Type(cpu_famt.l)
        My_Adapter_Info_List()\CPU_AddressWidth = Str(CPU\GetIntegerProperty("AddressWidth"))
        My_Adapter_Info_List()\CPU_DataWidth_Total = Str(CPU\GetIntegerProperty("DataWidth"))
        My_Adapter_Info_List()\CPU_DataWidth_Core = Str(CPU\GetIntegerProperty("DataWidth") / CPU\GetIntegerProperty("NumberOfLogicalProcessors"))
        My_Adapter_Info_List()\CPU_Caption = CPU\GetStringProperty("Caption") 
        My_Adapter_Info_List()\CPU_Name = CPU\GetStringProperty("Name")
        My_Adapter_Info_List()\CPU_ProcessorId = CPU\GetStringProperty("ProcessorId")
        My_Adapter_Info_List()\CPU_GUID = CPU\GetStringProperty("UniqueId")
        My_Adapter_Info_List()\CPU_SocketType = CPU\GetStringProperty("SocketDesignation")
        My_Adapter_Info_List()\CPU_DeviceID = CPU\GetStringProperty("DeviceID") 
        My_Adapter_Info_List()\CPU_MaxClockSpeed = Str(CPU\GetIntegerProperty("MaxClockSpeed"))
        My_Adapter_Info_List()\CPU_L2CacheSize = Str(CPU\GetIntegerProperty("L2CacheSize"))
        My_Adapter_Info_List()\CPU_L2CacheSpeed = Str(CPU\GetIntegerProperty("L2CacheSpeed"))
        
        ;NumberOfCores is less than NumberOfLogicalProcessors = hyperthreading
        If CPU\GetIntegerProperty("NumberOfCores") < CPU\GetIntegerProperty("NumberOfLogicalProcessors")
        My_Adapter_Info_List()\CPU_Hyper_Thread = "Yes"
        Else
        My_Adapter_Info_List()\CPU_Hyper_Thread = "No"
        EndIf 
                        
        CPU\Release()
        PROC\Release() 
        CPU = sysCPU\GetNextObject()
        PROC = procCPU\GetNextObject() 
      Wend 
      sysCPU\Release()
      procCPU\Release() 
    EndIf 
    
    objWMIService\Release()  
  EndIf 
EndProcedure



