简体   繁体   中英

How do I get the CPU socket type? (C#)

I'm developing an application which needs to check the CPU socket type at some point. How can I get the proper socket? I tried to do it via WMI using Win32_Processor class, but I couldn't find descriptions of modern sockets at MSDN help ( http://msdn.microsoft.com/en-us/library/windows/desktop/aa394373(v=vs.85).aspx ) There are only old kinds of sockets. Where can I get the updated info for this stuff? Or maybe there is an alternate way to get a socket information? Thanks in advance.

You can use System.Management.Instrumentation to query Win32_Processor

Example:

string processorSocket;

var processor = new ManagementObjectSearcher("select * from Win32_Processor").Get().Cast<ManagementObject>().FirstOrDefault();
if (processor != null)
{
    processorSocket = (string)processor["SocketDesignation"];
}

// returns: Socket M2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM