Important alert: (current site time 7/16/2013 2:58:02 AM EDT)
 

winzip icon

UPDATED 10/21/03 - Detect cpu make, model, features, cache, speed etc.

Email
Submitted on: 10/7/2003 12:54:00 PM
By: Paul Caton 
Level: Advanced
User Rating: By 54 Users
Compatibility: VB 6.0
Views: 38353
 
     x86 cpu's have the ability to self-report their make, model, family, features, cache details etc. The included cCPUID class allows the programmer to execute this instruction and retrieve the results. To abstract the complexities of decoding the CPUID data, the included cCpuInfo class presents the programmer with a series of read-only properties. As an example of this, the included VBCPUID application displays the information presented by the cCpuInfo class. If you are wondering why the 'Real Time Speed' display - try running the VBCPUID app on a SpeedStep cpu. If you own an unusual cpu, such as an Athlon 64/Opteron, Cyrix etc... I'd be gratefull if you'd go to the 'Actions' tab, 'Save Data...' and email the file to me.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 13 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
10/7/2003 4:06:45 PMReadError

I'll try it at home tonight on my Athlon XP 2800+ and tell you the results, currently here, it says I have hyper-threading on a P4 1.6 Ghz, it's a little strange, no?
(If this comment was disrespectful, please report it.)

 
10/7/2003 4:49:40 PMPaul Caton

ReadError, My guess, i'll do a little research, is that the HT technology (in it's earliest forms) was built in from the very begining of the P4... that Intel revised and improved the technology as they released each new model and only switched it on, enabled it, when they got to the 2.8Ghz??? model. IOW, there's a little logic to add to the app beyond merely reporting what the CPU tells me... I'm not guessing here, just reporting what the processor tells me. Anyway, I'll look into it some more.
(If this comment was disrespectful, please report it.)

 
10/7/2003 6:03:03 PMReadError

I tested on my athlon, everything seems OK, also do you know how to look for MMX+, 3DNOW and 3DNOW+ support?
(If this comment was disrespectful, please report it.)

 
10/7/2003 9:10:39 PMPaul Caton

UPDATE - 3DNOW detection added. One advantage of voting is that I can email you regarding any updates.
(If this comment was disrespectful, please report it.)

 
10/7/2003 10:07:49 PMReadError

it's working great, I see 3dnow and 3dnow+ supported and the full name string (AMD Athlon(tm) XP 2800+)
(If this comment was disrespectful, please report it.)

 
10/7/2003 10:29:38 PMSystem33r

This is quite nice!
(If this comment was disrespectful, please report it.)

 
10/8/2003 4:23:03 AMLight Templer

It must be great when you are able to speak assembler AND VB! Fine stuff, as always! A short notice to the useable Win OS versions would in your description here would be helpful (W98 only? Or all up to XP?) 5 from me and regards! Light Templer
(If this comment was disrespectful, please report it.)

 
10/8/2003 5:45:36 AMPaul Caton

LT, I *hope* it works on all Windows OS's - I don't have access to Win9x but I imagine someone would have complained by now. Thanks for the vote, as ever.
(If this comment was disrespectful, please report it.)

 
10/8/2003 8:02:24 AMPaul Caton

If anyone out there has a Hyper-Threading P4 (Genuine, not just reported as such) Question: does the app report 2 "Logical CPU's" ??

Oops, spoke too soon. Just got a report of a problem of hanging in the IDE w/Win98 - Exe ran, but reported a stack error on exit. Maybe the OS, might be the CPU. Investigating...
(If this comment was disrespectful, please report it.)

 
10/8/2003 10:41:39 AMloopz87

as always...great job.
*****, you deserve them.
(If this comment was disrespectful, please report it.)

 
10/8/2003 1:46:35 PMRuturaj

This is a fantastic start for any RegKeyGen program. All info collected in nice way !

Great work. ASM+VB is always great to see working. Somebody said about the Support OS ... well , I've tested it on Win98 , Win2000 Server , Workstation and WinXP ... everything worked fine. Not tested it on NT though.
(If this comment was disrespectful, please report it.)

 
10/8/2003 2:59:59 PMPaul Caton

Ruturaj, thanks for the vote, thanks for the OS confirmation, I suspect the win98 report I received was a one-off.

Re RegKeyGen: oddly, there's just such a submission currently at the top of the monthly contest leader board. I mailed him yesterday, he's looking into it. This gives me a plan for an update... I'll create a cCpuInfo class that abstracts all the grunt-work calls into the cCPUID class, decoding the data and presenting a bunch of read-only properties to the user. I'll then write a CPUID form app to present that data. That way, a user that wants a easy way to get the data for their own app can just instantiate the cCpuInfo class and read the appropriate properties... they won't need to pull apart my existing code.

If this interests you PSC'ers, be sure to vote, or at least leave a comment/mail me and I'll inform you when I do the update. Shameless me :-)
(If this comment was disrespectful, please report it.)

 
10/9/2003 2:30:11 AMMaRiØ G. Serrano

impresionant use of class functions patching!!! 5g
(If this comment was disrespectful, please report it.)

 
10/9/2003 5:30:31 AMJing Polito

u deserve 5 g's
(If this comment was disrespectful, please report it.)

 
10/9/2003 12:18:08 PMManuel Muñoz

In my PIII works fine, but in a PII it fall in a do-loop ....?
If I change the code in the lines:
'---------------------------
'Loop thru the extended levels
Set itm = lv.ListItems.Add(,...
itm.Bold = True .....
nLevel = EXT_LEVEL 'is correct?
eax = EXT_LEVEL ' <---added
nLevel = 0 ' <---added
'---------------------------
Then works.
Is OK?

God work 5 globes!.


(If this comment was disrespectful, please report it.)

 
10/9/2003 1:47:06 PMPaul Caton

Manuel, Ah-Ha! thanks, that helps.
(If this comment was disrespectful, please report it.)

 
10/9/2003 11:20:14 PMDenVoronov

Nice coding, but
"Serial Number"=Not available
Running on Windows XP HE,Notebbok Toshiba Sattelite, CPU 2.6 Mhz P4
(If this comment was disrespectful, please report it.)

 
10/10/2003 3:26:54 AMAgung Nugroho

Works fine on mine, P4 2GHz W2K Svr. Thanks
(If this comment was disrespectful, please report it.)

 
10/10/2003 3:29:05 AMAgung Nugroho

uhmm.. except the 'Serial Number' thing
(If this comment was disrespectful, please report it.)

 
10/10/2003 4:44:35 AMPaul Caton

Re: The Serial Number thingy.... Intel introduced it on the P3 but then, under pressure from privacy advocates, removd it from the P4. They also released info on how to disable it on the P3. So, you'll only see the SN if... you've got a P3 and it hasn't been disabled (usually, I think, in the BIOS).
(If this comment was disrespectful, please report it.)

 
10/11/2003 8:20:20 AMPeter Hebels

Tested it on an AMD XP 2000+, worked great! Also the speed calculation is very interresting.

5 globes from me :)
(If this comment was disrespectful, please report it.)

 
10/11/2003 9:05:21 AMVlad Vissoultchev

Hi Paul,

Here is my QA report: P4 2.4GHz w/ HT on Win2k3 working ok. Also tested on Win98 under VMWare -- passed, including speed calculation (+/- fraction of a percent)! :-)))

cheers,
</wqw>
(If this comment was disrespectful, please report it.)

 
10/12/2003 12:14:14 PMAlexandru Ionescu

Great code again Paul!
Did you get my last two emails? Perhaps your inbox was full...I wasn't able to send them...
(If this comment was disrespectful, please report it.)

 
10/14/2003 9:16:06 AMOR13

A great code! I wanted to write a pretty angry comment, because I saw that you used Paul Caton's assembly-code, but... I found-out that you're him, so thanx for a great code.
By the way... Can you submit an explanation on how to use assembly in VB? I would be thankful... It's really important to me, because VB was my speciality and now I'm forgetting it because I love assembly. A combination will be more than helpful to me! (by the way, 5 globes from me...)
(If this comment was disrespectful, please report it.)

 
10/14/2003 2:14:46 PMReadError

I was wondering how you made the screenshot with my stats file, then I saw the load file button hehe, nice update.
(If this comment was disrespectful, please report it.)

 
10/14/2003 3:13:08 PMPaul Caton

OR13, LOL. okay, okay... I'll FORCE myself to do a tutorial or something on the subject. I can't help it, things like that make me sweat
(If this comment was disrespectful, please report it.)

 
10/14/2003 10:20:58 PMRuturaj

Hi Paul !

I got your mail on Update of this Class. (dated : Tue, 14 Oct 2003 13:55:44 -0500)

Great to see that you've continued working on this complex topic & making it as easy as possible for others. And also , you're kind enough to share your source code with us ...

I'm going to download the Update and eager to see & test the changes.

Regards.

Ruturaj.
(If this comment was disrespectful, please report it.)

 
10/14/2003 10:49:42 PMAlexandru Ionescu

Great Paul...amazing :) I've PMed you my email...hotmail still won't let me reply you.
(If this comment was disrespectful, please report it.)

 
10/15/2003 6:13:30 AMPaul Caton

Further to my description comment... even if you don't have an *interesting* or unusual cpu, feel free to send me a data file... I'd like to include a spectrum of processors with the project for comparison purposes. Fear not, there's nothing in the data file to ID YOU! It's just a text file, take a look-see.
(If this comment was disrespectful, please report it.)

 
10/15/2003 6:23:51 AMAgung Nugroho

I'm waiting for Vlad's action. Paul initiates something interesting and then Vlad will do so hehehe... Great update, Paul. C'mon Vlad, do something :-)
(If this comment was disrespectful, please report it.)

 
10/15/2003 11:49:19 AMPaul Caton

Minor update 10/15 - nothing drastic, mainly visual, no functional differences.
(If this comment was disrespectful, please report it.)

 
10/16/2003 2:14:39 AMRobert Rayment

All OK on Win98 PII now *****
(If this comment was disrespectful, please report it.)

 
10/16/2003 2:27:19 AMRobert Rayment

.. but serial number unavailable.
(If this comment was disrespectful, please report it.)

 
10/16/2003 4:35:30 AMPaul Caton

Robert, The Serial Number: Intel
introduced it on the P3 but then, under pressure from privacy advocates, removed it from the P4. They also released info on how to disable it on the P3. So, you'll only see the SN if... you've got a P3 and it hasn't been disabled (usually, I think, in the BIOS).

(If this comment was disrespectful, please report it.)

 
10/18/2003 4:38:34 PMKeith Stanier

This is the best app I've seen for CPU info. Works great with Win98SE. I don't see why you need to save the last CommonDialog path in the registry. Keep up the good work, 5 globes from me.
(If this comment was disrespectful, please report it.)

 
10/20/2003 1:52:05 PMPaul Caton

Small update... I noticed a problem when the class was compiled native and optimized (either small or fast). I hate that, different behaviour based on compilation options and i'm not talking about aliasing.
(If this comment was disrespectful, please report it.)

 
10/21/2003 7:10:28 AMPaul Caton

Another small update... I located the cause of the issue, a small bug in the cpuid assembler that was only exposed by compiling optimized. The real surprise is that compiling un-optimized-native or psuedo code was tolerating a stack adjustment goof. I'll email those that voted to warn them and appraise them of the update. Scary.
(If this comment was disrespectful, please report it.)

 
10/27/2003 6:29:32 AMHappy Lobster

Great code. Works a treat. 5 globes. Say no more.
(If this comment was disrespectful, please report it.)

 
11/16/2003 7:40:19 AMLam Ri Hui

congratulation Paul, you are the ocntest winner of the month.
(If this comment was disrespectful, please report it.)

 
11/25/2003 9:58:42 AMNathanael B

Wow, this looks awesome, 5 globes!!
(If this comment was disrespectful, please report it.)

 
11/28/2003 11:02:56 AM


(If this comment was disrespectful, please report it.)

 
12/9/2003 4:26:23 AM

Hi paul phenominal work bro, i have a 2.8ghz HT cpu (800mhz fsb) and it does report 2 logical cpu's. Great Great work!
(If this comment was disrespectful, please report it.)

 
12/9/2003 4:27:51 AM

that was me ^^^ btw 5 globes from me
(If this comment was disrespectful, please report it.)

 
12/19/2003 1:25:23 PMPatrick Dickey

I'm downloading your program with the intent to combine it with the
(If this comment was disrespectful, please report it.)

 
1/6/2004 11:19:12 PM

thx 4 paul, ur code realy give me hands to finish my final project

thx a lot
(If this comment was disrespectful, please report it.)

 
3/8/2004 3:55:35 PM

Excelente!
(If this comment was disrespectful, please report it.)

 
4/17/2004 12:28:43 AM

Good software comes in hand. I made it an (.EXE) so if any one doesn't have (VB) it will still work if they want it.

Thanx
(If this comment was disrespectful, please report it.)

 
4/29/2004 11:22:54 PM

That is a great program. Please keep me posted on any up-dates. Merci!
(If this comment was disrespectful, please report it.)

 
6/26/2004 10:20:48 AM

Great program. Five * from me.
Please keep me posted on all updates.
Rej
(If this comment was disrespectful, please report it.)

 
6/26/2004 12:40:13 PM

Can only say *****
and thanks!!

(If this comment was disrespectful, please report it.)

 
8/24/2004 10:45:31 PM

Great code, well done!
(If this comment was disrespectful, please report it.)

 
9/8/2004 4:43:24 PMTim Rude

Very cool code!

Works beautifully on my Athlon 2400+ with Win2K.

I compiled it and tried running it on a very old AMD 586-133 (80486 class) machine running Win95B. The program crashes on this old machine.

Is this code backwards compatible with pre-Pentium machines running Win95?
(If this comment was disrespectful, please report it.)

 
10/13/2004 3:30:14 PM

This is a great Code 5 *. Please keep me
posted on any up-dates, I see that the M processors by Intel are not detected.

yad@aquanet.co.il
(If this comment was disrespectful, please report it.)

 
10/26/2004 10:47:06 PMBrian Payne

I LOVE YOU.

5 Ferraris from me.
(If this comment was disrespectful, please report it.)

 
10/26/2004 11:59:57 PM

Suggestion. For hyperthreading, could you do the check that hyperthreading is enabled in the BIOS? Im pretty sure your code will report the existance of hyperthreading as a CPU capability, regardless of whether the BIOS has it enabled. I believe it involves calls to GetProcessAffinityMask(). The Intel CPU Count utility has source code, but im having trouble translating it to VB.
Thanks.
(If this comment was disrespectful, please report it.)

 
10/27/2004 2:25:55 AM

Paul. Im still trying to get the hyper-threading bios/OS recognization verification code to work. So far my C to VB translation is working but there is a snippet of ASM code and im wondering if you could convert this into one of those Hex strings so that i can do the VTAble method.

'unsigned char GetAPIC_ID(void)
'{
' unsigned int Regebx = 0;
' if (!HTSupported()) return (unsigned char) -1; // HT not supported
' // Logical processor = 1
' __asm
' {
' mov eax, 1
' CpuID
' mov Regebx, ebx
' }
'
' return (unsigned char) ((Regebx & INITIAL_APIC_ID_BITS) >> 24);
'
'}
(If this comment was disrespectful, please report it.)

 
3/12/2005 7:33:26 AMGB

Mine does not show HT enabled, which it should not. Good job, it sees the Dual Opteron 242's.
(If this comment was disrespectful, please report it.)

 
5/5/2005 1:11:42 PMSpector

Great job Paul! I'm trying to figure out how to retrieve the CPU's multiplier, Bus speed, and codename. Also the cpu brand function returns "67598" when other cpu info programs return "14". My cpu a P4 mobile.
(If this comment was disrespectful, please report it.)

 
5/10/2005 9:44:00 PMSpector

I fixed the bug in the "CpuBrand" function, the first part should read:

If m_nLevelsStd >= 1 Then
CpuBrand = Std(1).ebx And &HFF
End If

This will return the correct CPU Brand ID. I've also figured out how to decipher the CPU codename as well and much more detail on model types. The retrieval of cache descriptors for Cyrix and Via processors is also in the works.

I want to thank Paul Caton again for the excellent starting point!
(If this comment was disrespectful, please report it.)

 
5/11/2005 4:00:17 AMPaul Caton

Hey Spector, if you want to take on the project and resubmit with your changes, that's okay with me.
(If this comment was disrespectful, please report it.)

 
5/11/2005 10:06:16 PMSpector

Thanks, I just might do that!
(If this comment was disrespectful, please report it.)

 
5/14/2005 8:18:47 PMPaul Caton

If it's any help, I got my data from...

http://www.sandpile.org/ia32/cpuid.htm

It seems there's two new std levels (4 & 5) for multi-core. Dunno how up to date it is.
(If this comment was disrespectful, please report it.)

 
5/26/2005 6:43:36 AM

after going through your code and the website you have told us about I have finally beable to update the models for newer cpus. Such as my AMD 64 3500+ doesnt show a model nunber with your code, only cuase it is a newer chip. well that site is awsome and I was able to find the right keys to add in and get the up updated. Thanks agin.
(If this comment was disrespectful, please report it.)

 
6/28/2005 7:48:35 AMSpector

I will be resubmitting my changes soon, I got sidetracked on a couple projects. It now supports models and codenames for all processors except the new dual-core pentiums (I don't know anyone who has one). I will fix the HT status issue when I get my new P4 HT cpu in a couple weeks. I'm still having trouble determining the cpu multipler and bus speed. I believe the key is found somewhere is the MSR.
(If this comment was disrespectful, please report it.)

 
6/28/2005 7:51:04 AMSpector

Addon:

I've seen some c++ implementations use the cpu's FID and pass it lookup tables to get the multipler and bus speed. If anyone can help out on this, please do.
(If this comment was disrespectful, please report it.)

 
12/4/2007 1:20:57 AMRuturaaj

Hi! I'm trying to import classes to my existing application and when I try yo get the speed of CPU, I get Division by Zero error. Can't understand why this is happening so. Also, I tried to compile a DLL of Classes and face the same issue. I'm new to VB and ASM. Paul, can you please guide me how to make it to work as DLL or OCX? I'm sure I will get to learn a lot from your guidance. Eagerly waiting for your reply ...

-- Ruturaaj.

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.