Search code examples
c#.netwmi

Determine which instructions are supported by the processor


CPU-Z is able to determine the instructions your processor supports. For example the following link shows these instructions:

MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, EM64T

Is there a way to accomplish this using .NET, WMI or some other technology?


Solution

  • In kernel32.dll you have the function IsProcessorFeaturePresent which you can pInvoke.

    Edit
    Regarding EM64T extended instruction set, this is only available on x64 platforms so you can check which type of CPU is present through WMI:

    public static bool IsEM64TSupported()
    {
      ManagementObject mo;
      mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'");
      ushort i = (ushort) mo["Architecture"];
    
      return i == 9;
    }
    

    But since EM64T instructions are not available in 32-bit operating systems you'll need to check that too.