I have a system with 4 Physical Processor sockets. Running Windows 2003, I would like to programmatically find the number of sockets using C++. Is this possible and if so, how?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For Windows 7 and 2008 server there is the GetActiveProcessorGroupCount function. But you have 2003 server, so it’s not an option.
In C++ this requires to write WMI consumer code, which is a clumsy and boring (D)COM stuff.
One nice solution would be to run
systeminfocommand and parse the output, but be careful as the output’s column header is localized to system’s locale.EDIT
Just found a much nicer solution, which makes use of the command-line interface to WMI.
Run the following command and parse output, there is one line per socket
Running an exe and parsing output in C++ should the easy part. You can also use POCO library or Boost.Process to have cleaner code.
(this is untested code)