Alex
Alex

Reputation: 11

Detect i3/i5/i7 Intel Core Family at runtime

I'm trying to detect if the current process is running on an Intel Core of the family i3/i5 or i7, if possible with GetSystemInfo/GetNativeSystemInfo and SYSTEM_INFO. I did find some exhaustive code of all possible CPU detection using CPUID & VendorID, but right now I'd like to stay away from it, and it looks like it would be possible with GetSytemInfo with the proper information.

I'm simply running this:

SYSTEM_INFO si;
GetSystemInfo(&si);

It looks like the wProcessorRevision and wProcessorLevel should be able to give that information. On the i5 I have to test here I get:

wProcessorArchitecture = 0   (correct)
wProcessorLevel = 6
wProcessorRevision  = 7685

I tried to look everywhere, no specs whatsoever for the latest Intel core family. Everything I can find is too old for that... Any idea?

Upvotes: 1

Views: 2562

Answers (3)

Brendan
Brendan

Reputation: 37222

What I'd suggest is that you tell us the reason why you think you want to know if the CPU is Intel i3/i5/i7 or not; so that we can tell you that you're wrong and that you should be using the feature flags returned by CPUID or something else instead. Basically there isn't enough information provided to give you the answer you need (there's only enough information to give you the answer you asked for). :-)

The "wProcessorLevel" and "wProcessorRevision" fields of the SYSTEM_INFO structure are practically useless because you have no idea who the CPU manufacturer is. You could use the VendorID from CPUID to (attempt to) determine the manufacturer, but if you do that you can get the family/model/stepping information at the same time.

The "wProcessorLevel" looks like it's taken directly from "CPUID.family". For "wProcessorLevel = 6" it could be any Intel CPU from Pentium II to the latest Nehalem, excluding Netburst based CPUs (e.g. Pentium 4). It could also be AMD K7, Cyrix M2, VIA C3 or something else.

The "wProcessorRevision" field looks like it's derived from "(CPUID.model << 8) + CPUID.stepping". The stepping part should be ignored. The "CPUID.model" part (combined with the CPUID/family" part) is not enough to determine if it's a recent Intel Nehalem or an old CPU from a different manufacturer (that happens to use the same "CPUID.family" and "CPUID.model"). Ignoring the "wProcessorLevel" and only relying on the "CPUID.model" part would only make things worse.

Of course even with full identification information from CPUID it will be very hard to tell the difference between an i3/i5/i7 and a Nehalem based Xeon or Nehalem based Celeron, or whatever other brand names Intel feels like using (but there are ways if you actually do mean "i3/i5 or i7"), or determine if CPUs that Intel release in the future are or aren't i3/i5/i7 (there's no way to predict which family/model/stepping values Intel might use in the future). Also, don't forget that some CPUs allow the information returned by CPUID to be modified, so there's no strict guarantee that a CPU that returns "vendorID = Intel, family = 6, model = 30" isn't something completely different (and therefore no strict guarantee that the "wProcessorRevision" and "wProcessorRevision" information is correct); and you'd need to look deeper than CPUID's vendor/family/model if this is a concern.

Upvotes: 1

Hans Passant
Hans Passant

Reputation: 941635

It's available from Intel. Start here, pick a model, click on "Download Datasheet", then the "Specification Update" to find the cpuid.

Upvotes: 1

Jon
Jon

Reputation: 437404

The specs you are interested in are called the "Intel specification update" document; you need to google for the document specific to the processor family you are interested in.

Upvotes: 1

Related Questions