CPU Core count - one, two, three, four... wait is it dual core or hyperthreading...

Raakin

ADSM.ORG Senior Member
Joined
Aug 12, 2008
Messages
373
Reaction score
6
Points
0
So... has anyone come up with a good way (simpler the better) to determine the CPU core count of their organization?

I do not know if you are like me but my AIX/Linux/Windows Admins may have access to the CPU core count but it usually takes them awhile to get that information back to me. Though I do have access to a good chunk of the servers I am less familiar with the AIX and Linux side of things.

I have been trying to device some scripts that calculate the CPU core count easily.

For AIX/Linux I was thinking of scripting and greping the output of /proc/cpuinfo.

Any sound/proven ways?
 
ohhh, you were looking for a script, sorry - I must have skipped over that part.

In all fairness, I debated between this License forum and Scripting.
 
In all fairness, I debated between this License forum and Scripting.

ok cwilloug needs more coffee today ;-)

does not a "query systeminfo" or "show config" shows you more informations about your system? I do not have to possibility to look for, but as far as I remember it will show you more details about your cpu? Or I'm wrong?
 
Never done this.. but this can help you... Since i'm doing all the BA installation for my windows server, i'v add it in my ba client intallation script.

- for windows create a vbscript that query the WMI CPU class. microsoft technet script center can give have the complet vbs for querying de CPU WMI classe. redirect this to a txt file.

- add it in the pre or post command on the backups schedule.

- grab the file and leave!

WMI will give you some information not all of it

This is a WMI query code of the Win32_Processor WMI class in vbscript.

USE AT YOUR OWN RISK!

Code:
On Error Resume Next
Dim strComputer
Dim objWMIService
Dim propValue
Dim objItem
Dim SWBemlocator
Dim UserName
Dim Password
Dim colItems
strComputer = "."
UserName = ""
Password = ""
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
 WScript.Echo "AddressWidth: " & objItem.AddressWidth
 WScript.Echo "Architecture: " & objItem.Architecture
 WScript.Echo "Availability: " & objItem.Availability
 WScript.Echo "Caption: " & objItem.Caption
 WScript.Echo "ConfigManagerErrorCode: " & objItem.ConfigManagerErrorCode
 WScript.Echo "ConfigManagerUserConfig: " & objItem.ConfigManagerUserConfig
 WScript.Echo "CpuStatus: " & objItem.CpuStatus
 WScript.Echo "CreationClassName: " & objItem.CreationClassName
 WScript.Echo "CurrentClockSpeed: " & objItem.CurrentClockSpeed
 WScript.Echo "CurrentVoltage: " & objItem.CurrentVoltage
 WScript.Echo "DataWidth: " & objItem.DataWidth
 WScript.Echo "Description: " & objItem.Description
 WScript.Echo "DeviceID: " & objItem.DeviceID
 WScript.Echo "ErrorCleared: " & objItem.ErrorCleared
 WScript.Echo "ErrorDescription: " & objItem.ErrorDescription
 WScript.Echo "ExtClock: " & objItem.ExtClock
 WScript.Echo "Family: " & objItem.Family
 WScript.Echo "InstallDate: " & objItem.InstallDate
 WScript.Echo "L2CacheSize: " & objItem.L2CacheSize
 WScript.Echo "L2CacheSpeed: " & objItem.L2CacheSpeed
 WScript.Echo "LastErrorCode: " & objItem.LastErrorCode
 WScript.Echo "Level: " & objItem.Level
 WScript.Echo "LoadPercentage: " & objItem.LoadPercentage
 WScript.Echo "Manufacturer: " & objItem.Manufacturer
 WScript.Echo "MaxClockSpeed: " & objItem.MaxClockSpeed
 WScript.Echo "Name: " & objItem.Name
 WScript.Echo "NumberOfCores: " & objItem.NumberOfCores
 WScript.Echo "NumberOfLogicalProcessors: " & objItem.NumberOfLogicalProcessors
 WScript.Echo "OtherFamilyDescription: " & objItem.OtherFamilyDescription
 WScript.Echo "PNPDeviceID: " & objItem.PNPDeviceID
 for each propValue in objItem.PowerManagementCapabilities
  WScript.Echo "PowerManagementCapabilities: " & propValue
 next
 WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
 WScript.Echo "ProcessorId: " & objItem.ProcessorId
 WScript.Echo "ProcessorType: " & objItem.ProcessorType
 WScript.Echo "Revision: " & objItem.Revision
 WScript.Echo "Role: " & objItem.Role
 WScript.Echo "SocketDesignation: " & objItem.SocketDesignation
 WScript.Echo "Status: " & objItem.Status
 WScript.Echo "StatusInfo: " & objItem.StatusInfo
 WScript.Echo "Stepping: " & objItem.Stepping
 WScript.Echo "SystemCreationClassName: " & objItem.SystemCreationClassName
 WScript.Echo "SystemName: " & objItem.SystemName
 WScript.Echo "UniqueId: " & objItem.UniqueId
 WScript.Echo "UpgradeMethod: " & objItem.UpgradeMethod
 WScript.Echo "Version: " & objItem.Version
 WScript.Echo "VoltageCaps: " & objItem.VoltageCaps
Next

you just have to play with it!
 
does not a "query systeminfo" or "show config" shows you more informations about your system? I do not have to possibility to look for, but as far as I remember it will show you more details about your cpu? Or I'm wrong?

"query systeminfo" does show a lot more info about the system, but oddly enough, not the cpu core count.

As far as "show config" I do not see where to use that command; is it a OS command or Tivoli?
 
AIX:

lsattr -El sys0 |grep ent_cap |awk {'print $2'}

(upper e lower L, some people think it is an upper i or the number 1)

This will show the number of CPU cores that are allocated to the server. If it is a full LPAR, it will show how many are in the server and if it is a partial LPAR, it will show how many are allocated to it in the HMC.

I think working with /proc/cpuinfo makes the most sense on Linux. I don't have a window open to a Linux box right now or I'd give you the syntax for it as well.

-Aaron
 
Back
Top